home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / bc7tb523.zip / TOOLBOX.DOC < prev    next >
Text File  |  1992-05-12  |  137KB  |  3,499 lines

  1.  
  2.             Assembly-Language Toolbox for QuickBASIC
  3.             ────────────────────────────────────────
  4.                        By Christy Gemmell
  5.  
  6. The Assembly-Language Toolbox started life, four years ago, as a simple
  7. collection of useful routines for adding zip to my QuickBASIC programs.
  8. They weren't just pretty faces however. In order to qualify, the Toolbox
  9. routines had to work reliably with real-life commercial applications, the
  10. ones on which my living depended. This made for pretty tough testing, but
  11. those which did survive were, in consequence, fast, robust and, above all,
  12. able to do the job. They are, in fact, doing so in Accountants and Stock-
  13. broker's offices, all over my native Great Britain.
  14.  
  15. A colleague uploaded a copy of the Toolbox onto a local BBS (Electronic
  16. Bulletin Board) and suddenly I started getting letters and phone calls
  17. from complete strangers asking for a copy of the latest version. Nearly
  18. everyone who called had suggestions of their own, remarking; "You know, if
  19. only the Toolbox had this, it would be really good...".
  20.  
  21. Wherever practicable, the good ideas (and some were brilliant) were turned
  22. into assembler code and added to the collection. Almost before I realised
  23. what was happening, the Assembly-Language Toolbox was on the Shareware
  24. circuit and being used by programmers in Europe, the USA, Canada,
  25. Australia and Japan. By December 1990 it had gone through four 'official'
  26. releases and a dozen or more unofficial ones.
  27.  
  28. Release Five comes in two flavours; one for QuickBASIC 4 and the other for
  29. Microsoft's BASIC 7 Professional Development System. The QB4 version
  30. covers QuickBASIC 4.0, 4.5 and BASIC 6 while the PDS version is compatible
  31. with BASIC 7, 7.1 and Extended QuickBASIC (QBX). In either version the
  32. routines are provided both as stand-alone libraries and as Quick Libraries
  33. for use in the programming environment.
  34.  
  35. Using the Toolbox is easy. All the routines are written to look like
  36. standard QuickBASIC SUB programs and FUNCTION procedures. All you have to
  37. do is choose the ones you want to use in your current program and paste
  38. the appropriate DECLARE statements (a full set is provided) into the
  39. source code. If you need to output large quantities of text to the screen
  40. at high speed, for example, just copy the following line from TOOLBOX.DEF.
  41.  
  42. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Text$, BYVAL Attribute%)
  43.  
  44. Then, if you are running in the QuickBASIC environment, you should load
  45. the Quick Library with the command:
  46.  
  47.     QB yourprog.bas /L toolbox.qlb
  48.  
  49. Thereafter you can call FastPrint, exactly as you would any other
  50. QuickBASIC SUB program, for example like this:
  51.  
  52.     FastPrint 25, 34, "Hello World!", 48
  53.  
  54. which will print 'Hello World!' in the middle of the 25th screen row
  55. displaying it in black characters on a cyan background (if you have a
  56. colour monitor). Notice that, since a DECLARE statement has been used, you
  57. don't need to place parentheses around the argument list and that even the
  58. CALL statement is unneccessary. Used in this way, Toolbox routines become
  59. actual extensions to the QuickBASIC language.
  60.  
  61. The same DECLARE statements can still be used when you compile your
  62. programs from the DOS command line. In this case, however, you must link
  63. the compiled program to TOOLBOX.LIB, the stand-alone library, with
  64. something like this:
  65.  
  66.     LINK yourprog,,,toolbox.lib;
  67.  
  68. The QuickBASIC Linker will only extract, from TOOLBOX.LIB, those modules
  69. which are explicitly named by DECLARE statements in the source file. This
  70. ensures that your programs are not burdened with unneccessary code.
  71.  
  72. Toolbox routines do not require the BASIC runtime module to be present.
  73. You can use them to produce completely stand-alone application programs
  74. which can be distributed commercially.
  75.  
  76. As its name implies, the core routines in the Assembly-Language Toolbox
  77. are written in pure Intel 80x86 assembler. Because of this they are small,
  78. efficient and blindingly fast. Moreover, since any internal variables are
  79. stored in a routine's own code segment, your program does not have to
  80. share any of it's precious data space with the library.
  81.  
  82. Christy Gemmell                                                 June 1991
  83.  
  84. ──────────────────────────────────────────────────────────────────────────
  85.  
  86. The ShareWare version of the Assembly-Language Toolbox for QuickBASIC is
  87. provided, free of charge, to any QuickBASIC programmer who can find a use
  88. for it. You are encouraged to copy it, upload it to Electronic Bulletin
  89. Boards or pass it on to friends, provided only that you make no charge for
  90. doing so and that all the files on the disk are preserved intact. You may
  91. freely include Toolbox routines in your own programs, both for private use
  92. and for commercial distribution, without payment to the author.
  93.  
  94. The Professional version of the Toolbox, available to Registered Users,
  95. comes complete with all the source code, object modules for building your
  96. own custom libraries and many additional features. Registration also
  97. entitles you to a free upgrade to Release 6 of the Toolbox, when it
  98. becomes available, and to subsequent releases at a greatly reduced price.
  99. Full Hotline support is also included, at no extra charge.
  100.  
  101. Also available is the Mixed-Language Toolbox for QuickBASIC - a collection
  102. of high-level routines which interface with the Assembly-Language Toolbox
  103. to produce a set of sophisticated mini-applications. The BarMenu and
  104. VerMenu modules, for example, can be used to give your programs a full-
  105. featured point-and-shoot menuing system, similar to the one built into the
  106. QuickBASIC programming environment. Once again, the source code for all
  107. mixed-language routines is provided so that you can tailor them to your
  108. exact requirements.
  109.  
  110. ─────Registration and Support──────────────────────────────────────────────
  111.  
  112. U.K. and Europe:        £25.00 (including postage and packing)
  113.  
  114. Christy Gemmell         Singular Software
  115.                         22 Peake Road, Northfields,
  116.                         Leicester LE4 7DN
  117.                         United Kingdom
  118.                         
  119.                 Tel:    (044)-0533-767960
  120.  
  121. U.S.A. and Canada:      $47.50 (Including shipping)
  122.  
  123. James Kreyling          CPC Consulting Company
  124.                         1217 Crescent Dive
  125.                         Smithfield, Va. 23430
  126.                         U.S.A.
  127.  
  128.                 Tel:    (804)-357-9190 (Voice and FAX)
  129. or from Club-PC BBS:    (804)-357-0357 (8-N-1)
  130.  
  131. Note:   When ordering the Toolbox please specify if for QuickBASIC 4.5
  132.         or BASIC 7 PDS and the floppy disk format you require.
  133.  
  134. ─────About the author─────────────────────────────────────────────────────
  135.  
  136. Christy Gemmell, the author of this package, is also major author of the
  137. definitive textbook on QuickBASIC programming, the QuickBASIC BIBLE, which
  138. is published by Microsoft Press, in association with the Waite Group, at
  139. £24.95 ($27.95 US) ISBN 1-55615-262-0. Selected as Computer Book of the
  140. Month by Jerry Pournelle in the March 1991 issue of BYTE, its thousand
  141. pages are packed with information, tips and example programs which you
  142. wont find anywhere else.  Look out for it in your local bookstore.
  143.  
  144. The Assembly-Language Toolbox for QuickBASIC is used by thousands of
  145. programmers in Great Britain, Europe, the USA and Canada, Australasia and
  146. Japan, to build fast and powerful QuickBASIC programs. It has been shown
  147. at COMDEX and was featured in the November 1990 issue of BYTE magazine.
  148.  
  149. ───────────────────────────────────────────────────────────────────────
  150.  
  151.                 TOOLBOX FUNCTIONS AND PROCEDURES
  152.  
  153. This is a full, alphabetical, listing of the routines in the Assembly
  154. Language Toolbox which can be called directly by QuickBASIC programs>
  155.  
  156.  
  157. ATTRIB
  158.  
  159. This function returns the directory attributes of the specified file.
  160.  
  161. DECLARE FUNCTION Attrib% (FileSpec$)
  162.  
  163. FileSpec$ is the name of the file whose directory entry is to be tested.
  164. You should include the full pathname (including drive letter if necessary)
  165. if the file is not in the current directory.
  166.  
  167. The returned attribute value is bit-encoded as follows:
  168.  
  169.    Bit     Meaning (if set)
  170. ─────────────────────────────────────────────────────
  171.     0      Read-only     (file is Read/Write if zero)
  172.     1      Hidden
  173.     2      System
  174.     3      Volume label
  175.     4      Subdirectory
  176.     5      Archive
  177.     6      Not used
  178.     7      Shareable     (Novell Networks only)
  179. ─────────────────────────────────────────────────────
  180.  
  181. The ToolBox procedures; HIDE, SECURE and SHARE (see below) can be used to
  182. modify the attributes of a file.
  183.  
  184.  
  185. ATTRIBUTE
  186.  
  187. Converts standard MS-DOS foreground and background COLOR values into
  188. their equivalent display attribute number.
  189.  
  190. DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  191.  
  192. Legal values:    Fore% = 0 - 31
  193.                  Back% = 0 - 15
  194.  
  195. The Assembly-Language Toolbox provides several routines which allow  your
  196. QuickBASIC programs to write text directly to the display with an
  197. attribute which you supply. For an explanation of display attributes, see
  198. the topic file COLOURS.HLP supplied with the Assembly-Language Toolbox
  199. demonstration program.
  200.  
  201. Note that the QuickBASIC COLOR statement only allows values of 0-7 for
  202. background colours. Toolbox display routines, however, accept the full
  203. range, using values of 8-15 to produce blinking or high-intensity
  204. background colours. See BLINKING (below) for a routine which allows
  205. you to select between these two modes.
  206.  
  207.  
  208. BACKFILL
  209.  
  210. This procedure changes the display attributes of the characters contained
  211. within the screen rectangle you specify, without overwriting the text
  212. itself.
  213.  
  214. DECLARE SUB BackFill (BYVAL R%, BYVAL C%, BYVAL H%, BYVAL W%, BYVAL A%)
  215.  
  216. R% = Top-left row of the rectangle to be coloured.
  217. C% = Top-left column of the rectangle.
  218. H% = Height of the rectangle in rows.
  219. W% = Width of the rectangle in columns.
  220. A% = Display attribute to use for colouring.
  221.  
  222.  
  223. BITSHL
  224.  
  225. Shifts all the bits of a long-integer number the specified number
  226. of places to the left.  This effectively multiplies the number by
  227. 2 ^ the number of places.
  228.  
  229. DECLARE SUB BitShl (Number&, Count%)
  230.  
  231. Number& =   The 32-bit number to be shifted 
  232.             (-2147483648 to 2147483647)
  233. Count%  =   The number of places to be shifted (1-31)
  234.  
  235.  
  236. BITSHR
  237.  
  238. Shifts all the bits of a long-integer number the specified number
  239. of places to the right.  This effectively divides the number by
  240. 2 ^ the number of places.
  241.  
  242. DECLARE SUB BitShr (Number&, Count%)
  243.  
  244. Number& =   The 32-bit number to be shifted 
  245.             (-2147483648 to 2147483647)
  246. Count%  =   The number of places to be shifted (1-31)
  247.  
  248.  
  249. BITRESET
  250.  
  251. Clears the specified bit (0-15) of the integer number supplied.
  252.  
  253. DECLARE SUB BitReSet (Number%, Bit%)
  254.  
  255.  
  256. BITSET
  257.  
  258. Sets the specified bit (0-15) in the integer number supplied to 1.
  259.  
  260. DECLARE SUB BitSet (Number%, Bit%)
  261.  
  262.  
  263. BITTEST
  264.  
  265. Returns logical TRUE (-1) if the bit (0-15) of Number% is set and FALSE
  266. (zero) if the bit is clear.
  267.  
  268. DECLARE FUNCTION BitTest% (Number%, Bit%)
  269.  
  270.  
  271. BLINKING
  272.  
  273. Toggles between blinking and high-intensity background colours
  274.  
  275. DECLARE SUB Blinking (BYVAL Switch%)
  276.  
  277. Switch% = 0         Turn background blink off/enable high intensity
  278.                     background colours.
  279.  
  280.         = non-zero  Enable background blinking/disable high intensity
  281.                     background colours
  282.  
  283. The QuickBASIC COLOR statement only recognises values of 0-7 for its'
  284. second parameter. Unlike the foreground, you cannot select blinking or
  285. high-intensity colours for the display backgound. The screen attribute
  286. parameter used with Toolbox routines such as FASTPRINT, however, do
  287. permit a background colour component in the range 0-15.
  288.  
  289. Normally, values between 8-15 will produce blinking backgrounds, but
  290. BLINKING allows you to turn the the blink off, forcing the background
  291. colour into high intensity mode. With blinking disabled you can use
  292. the full range of colours which are available to the foreground.
  293.  
  294. See ATTRIBUTE (above) for a function that calculates display attributes
  295. from the foreground and background colours you supply
  296.  
  297. Note:   This routine only works on systems with EGA, VGA and MCGA
  298.         display adaptors. Users of CGA adaptors, however, can get
  299.         the same effect by using the statement:  OUT &H3D8, 9
  300.  
  301. If you turn blinking off, remember to re-enable it before your program
  302. ends. Otherwise high-intensity backgrounds will remain in effect until
  303. another program resets the video card or you switch your computer off.
  304.         
  305.  
  306. CAPSLOCK
  307.  
  308. Toggles CAPS LOCK on or off or, alternatively, reads the current CAPS LOCK
  309. key setting.
  310.  
  311. DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  312.  
  313. Switch% = 0  Turns CAPS LOCK off
  314.         = 1  Turns CAPS LOCK on
  315.  
  316. Any other value just returns the current CAPS status as a logical value
  317. where -1 (TRUE) means that CAPS LOCK is on and 0 (FALSE) means that CAPS
  318. LOCK is off.
  319.  
  320.  
  321. CGACOPY
  322.  
  323. Copies a CGA screen to or from a user-supplied string.
  324.  
  325. DECLARE SUB CgaCopy (BYVAL Switch%, Buffer$)
  326.  
  327. SWITCH%     Direction of copy   0 = copy screen to string
  328.                                 1 = copy string to screen
  329.  
  330. BUFFER$     String variable to hold the screen image, must be at least
  331.             16384 characters long or the call will fail. 
  332.  
  333. Note:       If you are using QuickBASIC 4 or 4.5, do not pass a fixed-
  334.             length string to this routine. Only variable-length strings
  335.             will work safely.
  336.  
  337. The QuickBASIC PCOPY statement is very useful for storing screen pages in
  338. memory, so that they can be kept out of sight until needed. Unfortunately
  339. it only works in text modes or, on computers with EGA or VGA video cards,
  340. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  341. the CGA display modes (SCREENs 1 and 2), it provides a useful alternative
  342. to the PCOPY statement for use with medium-resolution screens.
  343.  
  344. See also MCGACOPY for a version that can be used with SCREEN 13 displays.
  345.  
  346.  
  347. CGASCROLL
  348.  
  349. Scrolls a rectangular portion of a SCREEN 1 (320 x 200 4-colour) display
  350. four pixels to the left or to the right, wrapping the pixels which are 
  351. scrolled out at the end round to the beginning again.
  352.  
  353. DECLARE SUB CgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  354.                        BYVAL yPixels%, BYVAL Direction%)                 
  355.  
  356. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  357.             the rectangle to be scrolled.
  358.  
  359. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  360.             the rectangle to be scrolled.
  361.  
  362. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  363.  
  364. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  365.  
  366. DIRECTION%  The direction in which the rectangle contents are to be
  367.             scrolled (0 = Left, 1 = Right).
  368.  
  369. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  370.  
  371. X co-ordinates are aligned to the nearest byte (1 byte = 4 pixels).
  372.  
  373.  
  374. CGATEXT
  375.  
  376. Writes characters to the screen in the 320 x 200 4-colour graphics mode.
  377.  
  378. DECLARE SUB CgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  379.                      BYVAL Attr%, BYVAL Scale%)
  380.  
  381. This routine provides a convenient way of displaying text in SCREEN 1
  382. without having to bother about loading external font files. It uses the
  383. standard ROM-BIOS character definition tables built into your display
  384. adaptor, but allows you to scale them up to eight times normal size and to
  385. specify any combination of foreground and background colours.
  386.  
  387. XLOC%       The horizontal co-ordinate of the top left hand pixel
  388.             from which the text will begin (0 - 319)
  389.  
  390. YLOC%       The vertical co-ordinate of the top left hand pixel
  391.             from which the text will begin (0 - 199)
  392.  
  393. TEXT$       The string of text to be displayed (up to 63 characters).
  394.  
  395. ATTR%       The colour (or display attribute in monochrome modes) to
  396.             be given to the text. This is calculated by the formula:
  397.  
  398.             Colour% = (Background% * 256) + Foreground%
  399.  
  400.             Foreground and Background values are in the range 0 - 3
  401.  
  402. SCALE%      The character size of the text to be displayed. This ranges
  403.             from 1 to 8, where 1 is standard 40-column text and where 8
  404.             multiplies the character size by eight on both the horizontal
  405.             and vertical axes.
  406.  
  407. CGATEXT can handle both byte-aligned and non byte-aligned characters. The
  408. x, y co-ordinates you supply do not need to correspond to a row, column
  409. character cell in SCREEN 0, the alphanumeric mode. The complete ASCII set
  410. is supported, but to display foreign symbols and box-drawing characters on
  411. a CGA adaptor you must have the DOS GRAFTABL utility loaded.
  412.  
  413. Since CGATEXT does not support clipping, to ensure a clean display you
  414. must ensure that the text to be output fits within the current screen
  415. boundaries.
  416.  
  417. See also VGATEXT for displaying characters in SCREENs 7-12 and MCGATEXT
  418. for displaying characters in SCREEN 13.
  419.  
  420.  
  421. CIPHER
  422.  
  423. This routine requires that you supply two strings of characters. The first
  424. is the text to be encrypted, and the second is one or more keywords which
  425. are used to encipher the text. Thereafter, the text cannot be decrypted
  426. until you supply the same key string again.
  427.  
  428. DECLARE SUB Cipher (Text$, KeyWord$)
  429.  
  430. The encryption algorithm XORs (eXclusive ORs) the key string with string
  431. to be encrypted. This allows you to reverse the procedure and decrypt the
  432. text, simply by calling the routine a second time.
  433.  
  434. See the source code for DEMON.BAS, the ToolBox demonstration program, for
  435. an example using CIPHER.
  436.  
  437.  
  438. CLEAREND
  439.  
  440. Blank spaces of the display attribute specified are printed, starting at
  441. the current cursor position and continuing to the end of the line or,
  442. optionally, to the end of the screen.
  443.  
  444. DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  445.  
  446. Switch%   0 = clear to the end of the line.
  447.           1 = clear to the end of the screen.
  448.  
  449. Attr%     display attribute (1 - 255). If zero is specified then the
  450.           attribute of the character under the cursor is used.
  451.  
  452. Example:  ClearEnd 1, 0
  453.  
  454. Clears from the current cursor position to the bottom of the screen. The
  455. area cleared takes the background colour of the character under the
  456. cursor. The cursor, itself, is not updated.
  457.  
  458.  
  459. CPU
  460.  
  461. This function checks to see what type of microprocessor is installed in
  462. the computer in which the current program is running.
  463.  
  464. No calling parameters are required.
  465.  
  466. DECLARE FUNCTION Cpu% ()
  467.  
  468. The following processors can be identified by their return values :
  469.  
  470.  86 = Intel 8086          88 = Intel 8088         188 = Intel 80188        
  471. 186 = Intel 80186        286 = Intel 80286        386 = Intel 80386
  472. -86 = Intel 80C86        -88 = Intel 80C88         20 = NEC   V20
  473.  30 = NEC   V30
  474.  
  475. 486 = Intel 80486  included but not yet tested (lend us yours?).
  476.  
  477. This function is provided mainly for interest, although it can be used as
  478. an indication of how long a particular task will take to run. All of the
  479. Toolbox routines, in fact, are processor-independent and can be used on
  480. all types of IBM-PC, AT, PS/2 and compatible machines
  481.  
  482.  
  483. CURTAINS
  484.  
  485. This routine clears the display screen to the background colour specified
  486. by Attribute%. It differs from CLS in that the blanked-out area expands
  487. from a series of columns, giving the effect of a set of louvered blinds or
  488. curtains being closed. The Speed% parameter controls how quickly the
  489. routine runs, larger values making the curtains close more slowly.
  490.  
  491. DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attribute%)
  492.  
  493. Try this example for a fancy effect:
  494.  
  495. FOR I% = 255 TO 0 STEP -16: Curtains 40, I%: NEXT
  496.  
  497. This procedure calls the DELAY routine (see below). This ensures that the
  498. speed value you specify will produce the same result on computers with any
  499. type of processor or clock speed.
  500.  
  501.  
  502. DAYNUMBER
  503.  
  504. Convert a date in the form DD/MM/YYYY to a long integer. The values
  505. returned are valid with dates in the range 1/3/1900 - 31/12/2099.
  506.  
  507. DECLARE FUNCTION DayNumber& (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  508.  
  509. See the INTERVAL function (below) for a method of calculating the number
  510. of days between two Julian dates.
  511.  
  512.  
  513. DELAY
  514.  
  515. This procedure is like the QuickBASIC SLEEP statement, except that it
  516. allows you to specify an interval in milliseconds instead of just whole
  517. seconds. The delay will be exactly the same on a 4.77 MHz original PC as
  518. it would be on the latest 33-MHz 80486 machine.
  519.  
  520. DECLARE SUB Delay (BYVAL MilliSeconds%)
  521.  
  522. See the PAUSE routine (below) for a similar procedure which allows you to
  523. specify a delay in PC clock ticks.
  524.  
  525.  
  526. DISABLEPRTSC
  527.  
  528. This routine simply sets the Print Screen Busy flag at low-memory address
  529. 0040:0100 (Hex) so that any requests for the screen to be printed are
  530. ignored. Use this to prevent a careless operator from hanging-up the
  531. program by pressing <Prt Scrn> when the printer is off-line.
  532.  
  533. No calling parameters are required.
  534.  
  535. DECLARE SUB DisablePrtSc ()
  536.  
  537. Don't forget to use ENABLEPRTSC (see below) to re-enable this key
  538. otherwise it will remain disabled even after your program ends.
  539.  
  540.  
  541. DISKREADY
  542.  
  543. Tests if there is readable media in the floppy diskette drive specified. 
  544.  
  545. DRIVE% is the number of the diskette drive to be tested and is either
  546. zero (drive A:) or 1 (drive B:).
  547.  
  548. DECLARE FUNCTION DiskReady% (BYVAL Drive%)
  549.  
  550. This function returns a non-zero value if a readable diskette is in the
  551. drive, and zero (logical FALSE) if unable to read from the drive.
  552.  
  553. If the floppy disk in the drive specified is ready then the number that
  554. is returned is the Media Descriptor Byte, a value which indicates the
  555. type of diskette mounted, where:
  556.  
  557.       240   F0h  =  3.5"  2-sided, 18 sector
  558.       249   F9h  =  3.5"  2-sided, 9 sector or
  559.                     5.25" 2-sided, 15 sector
  560.       252   FCh  =  5.25" 1-sided, 9 sector
  561.       253   FDh  =  5.25" 2-sided, 9 sector
  562.       254   FEh  =  5.25" 1-sided, 8 sector
  563.       255   FFh  =  5.25" 2-sided, 8 sector             
  564.  
  565. DISKREADY only tests if the drive can be read from. It will not detect
  566. if the diskette in the drive is write-protected.
  567.  
  568.  
  569. DISPLAYMODE
  570.  
  571. Reads the current video display mode using the IBM ROM-BIOS numbering
  572. system.
  573.  
  574. DECLARE FUNCTION DisplayMode% ()
  575.  
  576. No calling parameters are required. Depending on the type of display
  577. adaptor installed, the function may return one of the following values:
  578.  
  579. Mode    Resolution      Mode     Colours    Remarks
  580. ─────────────────────────────────────────────────────────────────────
  581.   0     40 x 25         text        16      No colour burst
  582.   1     40 x 25         text        16      
  583.   2     80 x 25         text        16      No colour burst
  584.   3     80 x 25         text        16
  585.   4     320 x 200       graphics     4
  586.   5     320 x 200       graphics     4      No colour burst
  587.   6     640 x 200       graphics     2
  588.   7     80 x 25         text         2      Monochrome display only  
  589.   8     160 x 200       graphics    16      PCjr & Tandy 1000 only  
  590.   9     320 x 200       graphics    16      PCjr & Tandy 1000 only
  591.  10     640 x 200       graphics     4      PCjr & Tandy 1000 only
  592.  13     320 x 200       graphics    16      EGA & VGA
  593.  14     640 x 200       graphics    16      EGA & VGA
  594.  15     640 x 350       graphics     2      Monochrome EGA & VGA
  595.  16     640 x 350       graphics    16      EGA & VGA
  596.  17     640 x 480       graphics     2      VGA only
  597.  18     640 x 480       graphics    16      VGA only
  598.  19     320 x 200       graphics   256      VGA & MCGA      
  599. ─────────────────────────────────────────────────────────────────────
  600.  
  601. The SCREENMODE function (see below) can be used to return the equivalent
  602. QuickBASIC SCREEN number.
  603.  
  604.  
  605. DISPLAYPAGE
  606.  
  607. All video cards except the Monochrome Display Adaptor (MDA) are capable of
  608. switching between two or more pages of display memory. This function
  609. returns the number of the active video page, use the QuickBASIC SCREEN
  610. statement to select the page you require.
  611.  
  612. No calling parameters are required.
  613.  
  614. DECLARE FUNCTION DisplayPage% ()
  615.  
  616. The page number returned can be a value between 0 and 7, depending upon
  617. the current video mode and the amount of display memory installed.
  618.  
  619. Note:       all Toolbox routines which write directly to the screen will
  620.             automatically detect and send their output to the currently
  621.             active display page.
  622.  
  623.  
  624. DWPRINT
  625.  
  626. Sends the text supplied, to the printer, as a string of double-width
  627. characters. Output begins at the current print position and can,
  628. optionally, append a carriage-return/linefeed to take the print head to
  629. the beginning of a new line when finished.
  630.  
  631. DECLARE SUB DwPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  632.  
  633. Arguments:  Printer%    the parallel port output is to be sent to
  634.                         (1 = LPT1:, 2 = LPT2:, etc.).
  635.             Buffer$     the string of text to be printed.
  636.             NewLine%    set this to a non-zero value if you want 
  637.                         to move to a new line after printing.
  638.  
  639. The routine restores the previous print style or font before it returns
  640. and does not effect subsequent output to the printer, using the QuickBASIC
  641. LPRINT or PRINT # statements.
  642.  
  643. Note:       The version of this routine stored in the Toolbox
  644.             library is for EPSON compatible printers. If you have
  645.             an IBM graphics printer or ProPrinter, then you should
  646.             rebuild your libraries, using either the PRINTIBM.OBJ
  647.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  648.  
  649.  
  650. EMPRINT
  651.  
  652. Sends the text supplied, to the printer, as a string of emphasised
  653. characters. Output begins at the current print position and can,
  654. optionally, append a carriage-return/linefeed to take the print head to
  655. the beginning of a new line when finished.
  656.  
  657. DECLARE SUB EmPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  658.  
  659. Arguments:  Printer%    the parallel port output is to be sent to
  660.                         (1 = LPT1:, 2 = LPT2:, etc.).
  661.             Buffer$     the string of text to be printed.
  662.             NewLine%    set this to a non-zero value if you want 
  663.                         to move to a new line after printing.
  664.  
  665. The routine restores the previous print style or font before it returns
  666. and does not effect subsequent output to the printer, using the QuickBASIC
  667. LPRINT or PRINT # statements.
  668.  
  669. Note:       The version of this routine stored in the Toolbox
  670.             library is for EPSON compatible printers. If you have
  671.             an IBM graphics printer or ProPrinter, then you should
  672.             rebuild your libraries, using either the PRINTIBM.OBJ
  673.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  674.  
  675.  
  676. EMSERROR
  677.  
  678. Returns the code number of the last error which occurred during a
  679. call to the Expanded Memory Manager. If zero is returned, then no
  680. errors have occurred.
  681.  
  682. No calling parameters are required.
  683.  
  684. DECLARE FUNCTION EmsError% ()
  685.  
  686. Here is a list of possible error codes and their meanings:
  687.  
  688. 128  Internal error in EMM software     146  Source and target overlap
  689. 129  Malfunction in EMS hardware        147  Illegal region length
  690. 130  Memory manager busy                148  Region overlap
  691. 131  Invalid handle                     149  Offset outside logical page
  692. 132  Function not defined               150  Region length > 1MB
  693. 133  No more handles available          151  Cannot exchange overlap
  694. 134  Error in mapping context           152  Memory types undefined
  695. 135  Not enough pages exist             153  Not used
  696. 136  Not enough pages available         154  ARS not supported
  697. 137  Cannot allocate zero pages         155  ARS currently allocated
  698. 138  Page not allocated to handle       156  ARS not zero
  699. 139  Illegal physical page number       157  ARS not allocated
  700. 140  Save state area full               158  DMA channels not supported
  701. 141  Save of mapping context failed     159  Illegal DMA channel
  702. 142  Restore of mapping context failed  160  No handle for this name
  703. 143  Subfunction parameter not defined  161  Name already exists
  704. 144  Attribute type not defined         162  Memory address wrap
  705. 145  Feature not supported              163  Invalid pointer
  706.  
  707. 250  EMM not installed*                 251  LIM 4.0 required*
  708.  
  709. *    Toolbox error codes.
  710.  
  711. The descriptions are, of necessity, abbreviated. For more information 
  712. consult your EMS hardware manual or see:
  713.  
  714. Advanced MS-DOS Programming     by David Duncan     Microsoft Press
  715.  
  716.  
  717. EMSFRAME
  718.  
  719. Returns the segment address of the EMS page frame.
  720.  
  721. No calling parameters are required.
  722.  
  723. DECLARE FUNCTION EmsFrame% ()
  724.  
  725. The Page Frame is the area of conventional memory into which logical
  726. expanded memory pages are mapped. Under LIM 3.2 it is a contiguous
  727. block of 64RAM, divided into four 16K physical pages, located some-
  728. where between segments A000 and F000 Hex, but LIM 4.0 allows you to
  729. reserve additional 16K pages, wherever available memory exists. In
  730. either system you can rely on 4 consecutive 16K pages and this
  731. function returns a pointer to the first of them.
  732.  
  733.  
  734. EMSGET
  735.  
  736. Copies up to 64KB of data from expanded memory, starting at the
  737. logical page supplied, to an address in conventional memory.
  738.  
  739. DECLARE SUB EmsGet (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  740.                     BYVAL Page%, BYVAL Handle%, Done%)
  741.  
  742. Arguments:  Segment%  = segment address of target block to which
  743.                         data should be copied.
  744.             Offset%   = offset address, within target segment, to
  745.                         which data should be copied.
  746.             Length%   = length, in bytes (up to 64KB), of data to
  747.                         be copied. 
  748.             Page%     = logical EMS page holding the beginning of
  749.                         the data. If the block of data is bigger
  750.                         than 16KB, then copying will continue from
  751.                         subsequent pages until all the data has 
  752.                         been moved.
  753.             Handle%   = the EMS handle to which the page(s) have
  754.                         been allocated. This should be obtained by
  755.                         a previous call to the EMSRESERVE procedure
  756.                         (see below).
  757.             Done%     = a flag to hold the result of the operation.
  758.                         If the data was copied successfully, it is
  759.                         set to -1 (logical TRUE) on return. If zero
  760.                         (logical FALSE) is returned, the data was
  761.                         not copied successfully. In this case, you
  762.                         should make a call to the EMSERROR function
  763.                         to find out why.
  764.  
  765. If the target structure, to which the data is to be copied, is an
  766. array, you should specify its address by supplying the VARSEG and
  767. VARPTR of the first element. Be sure, however, that you do not copy
  768. a block of data bigger than the array size, otherwise you may 
  769. overwrite other variables, probably with disastrous results. 
  770.  
  771. See the EMSPUT procedure (below) for a means of copying data into
  772. logical expanded memory pages.
  773.  
  774.  
  775. EMSMAP
  776.  
  777. Map a logical expanded memory page to a physical page in the EMS
  778. Page Frame, making it accessible to your program.
  779.  
  780. DECLARE SUB EmsMap (BYVAL Handle%, Physical%, Logical%)
  781.  
  782. Arguments:  Handle%   = the EMS handle to which the logical page has
  783.                         been allocated. This will have been obtained
  784.                         by a previous call to the EMSRESERVE routine
  785.                         (see below).
  786.             Physical% = the number of the physical page to map
  787.                         (in the range 1 to 4).
  788.             Logical%  = the number of the logical page to be mapped
  789.                         (in the range from 1 to the number of pages
  790.                         allocated to Handle%).
  791.  
  792. For most applications, the EMSGET and EMSPUT procedures will be more
  793. useful, since they perform all the necessary mapping for you while
  794. moving data to and from expanded memory. If, however, you need to
  795. manipulate small quantities of data in expanded memory, use this
  796. routine to switch the relevant page into conventional memory, and
  797. the FARPEEK and FARPOKE utilities (see below) to examine or change
  798. the data itself.
  799.  
  800.  
  801. EMSOWNED
  802.  
  803. Returns the number of logical pages of EMS memory that have been
  804. allocated to the handle specified.
  805.  
  806. DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  807.  
  808.  
  809. EMSPAGES
  810.  
  811. Returns either the total number of EMS pages in the system, or the
  812. total number of free (unallocated) pages.
  813.  
  814. DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  815.  
  816. Argument:   Switch% = 1  return number of unallocated pages.
  817.                       0  return total number of pages in system.
  818.  
  819.  
  820. EMSPRESENT
  821.  
  822. Tests whether the Expanded Memory System driver has been installed
  823.  
  824. No calling parameters are required.
  825.  
  826. DECLARE FUNCTION EmsPresent% ()
  827.  
  828. Returns:    -1  (logical TRUE) if EMS driver is installed.
  829.              0  (logical FALSE) if EMS driver is not installed.
  830.  
  831. Note:       This function just checks that the EMS driver is in
  832.             memory and that the EMS interrupt vector is directed
  833.             to it, it does not test if the driver is active. Use
  834.             the EMSVERSION function (see below) to test this. If
  835.             the driver responds to that function, it can be safely
  836.             assumed to be active.
  837.  
  838.  
  839. EMSPUT
  840.  
  841. Copies up to 64KB of data to expanded memory, starting at the
  842. logical page supplied, from an address in conventional memory.
  843.  
  844. DECLARE SUB EmsPut (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  845.                     BYVAL Page%, BYVAL Handle%, Done%)
  846.  
  847. Arguments:  Segment%  = segment address of source block from which
  848.                         data is to be copied.
  849.             Offset%   = offset address, within target segment, from
  850.                         which data is to be be copied.
  851.             Length%   = length, in bytes (up to 64KB), of data to
  852.                         be copied to expanded memory. 
  853.             Page%     = logical EMS page to hold the beginning of
  854.                         the data. If the block of data is bigger
  855.                         than 16KB, then copying will continue onto
  856.                         subsequent pages until all the data has 
  857.                         been moved.
  858.             Handle%   = the EMS handle to which the page(s) have
  859.                         been allocated. This should be obtained by
  860.                         a previous call to the EMSRESERVE procedure
  861.                         (see below).
  862.             Done%     = a flag to hold the result of the operation.
  863.                         If the data is copied successfully, it will
  864.                         be set to -1 (logical TRUE) on return. If
  865.                         zero (logical FALSE) is returned, the data
  866.                         was not copied successfully. In this case,
  867.                         you should make a call to the EMSERROR
  868.                         function to find out why.
  869.  
  870. If the source structure, from which the data is to be copied, is an
  871. array, you should specify its address by supplying the VARSEG and
  872. VARPTR of the first element. You can also copy data from absolute
  873. addresses in memory to EMS, to copy the contents of the text screen,
  874. for example, to EMS logical page 2, use the command:
  875.  
  876.     EmsPut &HB800, 0, 4000, 3, Handle%, Done%
  877.  
  878. This assumes that your computer has a colour monitor. If you have a
  879. monochrome display, substitute &HB000 for the segment address.
  880.  
  881. See the EMSGET procedure (above) for a means of retrieving data from
  882. extended memory.
  883.  
  884.  
  885. EMSRELEASE
  886.  
  887. Free-up all the pages previously allocated to this handle, and make
  888. them available to other processes.
  889.  
  890. DECLARE SUB EmsRelease (BYVAL Handle%)
  891.  
  892. You should release all the EMS pages which have been allocated to
  893. handles owned by your program, before the program terminates. If
  894. this is not done, these pages will not be available to subsequent
  895. programs which may start up and will remain locked until the system
  896. is rebooted.
  897.  
  898.  
  899. EMSREQUEST
  900.  
  901. Asks for one or more logical pages of expanded memory to be made
  902. available to your program.
  903.  
  904. DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  905.  
  906. Arguments:  Pages%  = number of EMS pages to reserve.
  907.  
  908.             Handle% = if successful, this variable will hold the
  909.                       number of the EMS handle which controls the
  910.                       allocated pages. If unsuccessful, Handle%
  911.                       will be set to zero on return, in which case
  912.                       you should call the EMSERROR function (above)
  913.                       to see what went wrong.
  914.  
  915. You must use this handle in all subsequent calls to the Expanded
  916. Memory Manager which refer to these particular pages.
  917.  
  918. Before calling this procedure, it is a good idea to make a call to
  919. the EMSPAGES function (see above) to see how many pages are free.
  920.  
  921.  
  922. EMSRESIZE
  923.  
  924. Changes the number of pages allocated to an EMS handle.
  925.  
  926. DECLARE SUB EmsReSize (BYVAL Handle%, Pages%)
  927.  
  928. Arguments:  Handle% = a valid EMS handle to which logical expanded
  929.                       memory pages have already been allocated.
  930.  
  931.             Pages%  = the new number of pages to be allocated to
  932.                       this handle.
  933.  
  934. On return, Pages% will hold the actual number of pages that are
  935. now allocated to the handle. If this is different from the number
  936. of pages requested, then an error has occurred and you should call
  937. the EMSERROR function (see above) to check what happened.
  938.  
  939. You can request a number of pages less than or greater than the
  940. number previously allocated to the handle.
  941.  
  942. Note:       This facility is only available with LIM 4.0 EMS and
  943.             above.
  944.  
  945.  
  946. EMSVERSION
  947.  
  948. Returns the LIM version number of the Expanded Memory Manager.
  949.  
  950. No calling parameters are required.
  951.  
  952. DECLARE FUNCTION EmsVersion% ()
  953.  
  954. The number returned is a decimal integer where 32 represents LIM 3.2
  955. and 40 represents LIM 4.0. If zero is returned, then an error has
  956. occurred and you should call the EMSERROR function (see above) to
  957. find out what happened. Use the EMSPRESENT function (also above) to
  958. test that the EMM driver has, in fact, been installed.
  959.  
  960.  
  961. ENABLEPRTSC
  962.  
  963. This routine clears the Busy flag at low-memory address 0040:0100 (Hex) so
  964. that print-screen requests can be executed. Use it to cancel the effect of
  965. the DISABLEPRTSC procedure (above).
  966.  
  967. No calling parameters are required.
  968.  
  969. DECLARE SUB EnablePrtSc ()
  970.  
  971.  
  972. ENPRINT
  973.  
  974. Sends the text supplied, to the printer, as a string of enhanced
  975. characters. Output begins at the current print position and can,
  976. optionally, append a carriage-return/linefeed to take the print head to
  977. the beginning of a new line when finished.
  978.  
  979. DECLARE SUB EnPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  980.  
  981. Arguments:  Printer%    the parallel port output is to be sent to
  982.                         (1 = LPT1:, 2 = LPT2:, etc.).
  983.             Buffer$     the string of text to be printed.
  984.             NewLine%    set this to a non-zero value if you want 
  985.                         to move to a new line after printing.
  986.  
  987. The routine restores the previous print style or font before it returns
  988. and does not effect subsequent output to the printer, using the QuickBASIC
  989. LPRINT or PRINT # statements.
  990.  
  991. Note:       The version of this routine stored in the Toolbox
  992.             library is for EPSON compatible printers. If you have
  993.             an IBM graphics printer or ProPrinter, then you should
  994.             rebuild your libraries, using either the PRINTIBM.OBJ
  995.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  996.  
  997.  
  998. EXPLODE
  999.  
  1000. Clear a screen rectangle explosively. This as an alternative to the
  1001. SCROLL routine listed below.
  1002.  
  1003. DECLARE SUB Explode (BYVAL Y1%, BYVAL X1%, BYVAL Y2%, BYVAL X2%,_
  1004.                      BYVAL Attr%, BYVAL Speed%)
  1005.  
  1006. Arguments:  Y1%         =  Upper-left row of rectangle to be cleared
  1007.             X1%         =  Upper-left column of rectangle
  1008.             Y2%         =  Lower-right row of rectangle
  1009.             X2%         =  Lower-right column of rectangle
  1010.             Attr%       =  Display attribute or colour that rectangle
  1011.                            should be cleared to 
  1012.             Speed%      =  Speed (in milliseconds) of explosion.
  1013.  
  1014. The panel is cleared, starting at the centre point, and progressively
  1015. moving outwards until the defined borders are reached. This gives the
  1016. impression of the clear area exploding onto the screen.
  1017.  
  1018. This routine is called, internally, by the POPUP window function (see
  1019. below) whenever Zoom is specified.
  1020.  
  1021.  
  1022. FARPEEK
  1023.  
  1024. Reads a byte of data from anywhere in conventional memory.
  1025.  
  1026. DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL Offset&)
  1027.  
  1028. Arguments:  Segment&  = address of memory segment containing the byte
  1029.                         to be read.
  1030.             Offset&   = offset address, within the segment of the 
  1031.                         byte to be read.
  1032.  
  1033. Returns:    The contents of the byte specified as an integer value
  1034.             in the range 0 to 255.
  1035.  
  1036. Note:       parameters are passed as LONG integers to save you the
  1037.             hassle of having to convert argument values over 32767
  1038.             to negative signed integers. Do not use values greater
  1039.             than 65535, however, or the most significant word will
  1040.             be ignored and the address converted to Modulus 65536.
  1041.  
  1042. Using QuickBASIC's PEEK function to examine data which lies outside
  1043. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1044. required and then to reset it afterwards. This function allows you to
  1045. read bytes, directly, from anywhere in the 1 megabyte of addressable
  1046. RAM space your computer contains.
  1047.  
  1048. The FARPOKE procedure (below) complements FARPEEK by allowing you to
  1049. write a byte of data anywhere in the 1MB addressable PC workspace.
  1050.  
  1051. See also PEEKWORD and POKEWORD which allow you to read from and write
  1052. to memory, two bytes at a time.
  1053.  
  1054. Note:       If you have an Intel 286, 386 or 486-based computer with
  1055.             the Microsoft HIMEM.SYS driver loaded, you can even use
  1056.             FARPEEK to read from the first 64KB of Extended Memory.
  1057.             Setting the segment to &HFFFF and an offset in the range
  1058.             &H10 to &HFFFF allows you access up to 65520 bytes of
  1059.             memory ABOVE the normal 1MB limit.
  1060.  
  1061.  
  1062. FARPOKE
  1063.  
  1064. Writes a byte of data to anywhere in conventional memory.
  1065.  
  1066. DECLARE SUB FarPoke (BYVAL Segment&, BYVAL Offset&, BYVAL Byte%)
  1067.  
  1068. Arguments:  Segment&  = address of memory segment containing the byte
  1069.                         to be written to
  1070.             Offset&   = offset address, within the segment of the 
  1071.                         byte to be written.
  1072.             Byte%     = the value (0 to 255) to be written to the
  1073.                         specified byte.
  1074.  
  1075. Note:       addresses are passed as LONG integers to save you the
  1076.             hassle of having to convert argument values over 32767
  1077.             to negative signed integers. Do not use values greater
  1078.             than 65535, however, or the most significant word will
  1079.             be ignored and the address converted to Modulus 65536.
  1080.  
  1081. Using QuickBASIC's POKE function to write to memory which is outside
  1082. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1083. you want and then to set it back again afterwards. This function lets
  1084. you write bytes, directly, anywhere in the 1 megabyte of addressable
  1085. RAM space your computer contains.
  1086.  
  1087. The FARPEEK procedure (above) complements FARPOKE by allowing you to
  1088. read a byte of data from anywhere in the 1MB of addressable memory.
  1089.  
  1090. See also PEEKWORD and POKEWORD which allow you to read from and write
  1091. to memory, two bytes at a time.
  1092.  
  1093.  
  1094. FASTPRINT
  1095.  
  1096. This procedure can be used to display a string of text directly to video
  1097. memory. It is much  faster than the normal DOS services and does not
  1098. update the cursor.
  1099.  
  1100. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  1101.  
  1102. Row%        is the row where printing is to start.
  1103. Col%        is the column where printing is to start.
  1104. Message$    is the string of text to be printed.
  1105. Attr%       is the video attribute given to the text.
  1106.  
  1107. Row% and Col% follow the QuickBASIC convention of numbering screen rows
  1108. and columns with Row = 1, Column = 1 being at the top-left corner of the
  1109. display. The maximum value for Row% depends on the capabilities of the
  1110. video adaptor installed and is determined by the last WIDTH statement.
  1111. Normally it is 25 but may extend to 43 (EGA) or even 50 rows (VGA).
  1112. Maximum columns may be either 40 or 80 (the default).
  1113.  
  1114. If multiple screen pages are being used, FASTPRINT will correctly identify
  1115. the active one and output to the proper video address.
  1116.  
  1117.  
  1118. FILEDATE
  1119.  
  1120. Gets or sets the date and time of the specified file as is displayed in
  1121. directory listings.
  1122.  
  1123. DECLARE SUB FileDate (BYVAL Switch%, DateTime$, FileSpec$)
  1124.  
  1125. Switch%     if set to a value of 1, changes the date and time of the file
  1126.             to the parameters specified in DateTime$. Any other value
  1127.             returns the date and time that the file was last written to
  1128.             in DateTime$
  1129.  
  1130. DateTime$   A string of at least 17 characters in length. If setting the
  1131.             date and time of a file, this must be written in a standard
  1132.             UK date/time format, ie:
  1133.  
  1134.             "DD/MM/YY HH:MM:SS"
  1135.  
  1136.             If you are reading the date and time, it is not necessary to
  1137.             pre-format the string, as the function will do it for you. The
  1138.             string must be of sufficient length to hold the returned date
  1139.             and time, however, or the procedure will fail.
  1140.  
  1141. FileSpec$   A string holding the pathname of the file to be examined or
  1142.             changed. It can include the drive letter and directory path
  1143.             were appropriate, but must be an explicit pathname. Wildcard
  1144.             characters are not allowed. Maximum length is 64 characters.
  1145.  
  1146. The procedure will fail if the file does not exist or is not on the path
  1147. specified. Also, since the file is actually opened by the procedure, there
  1148. must be at least one free DOS file handle available when you call it.
  1149.  
  1150. You cannot change the date and time of a file which has been flagged as
  1151. readonly or, on a network, is owned by another program.
  1152.  
  1153.  
  1154. FLOPPYDRIVES
  1155.  
  1156. This function returns the number of installed diskette drives in the
  1157. current computer system.
  1158.  
  1159. DECLARE FUNCTION FloppyDrives% ()
  1160.  
  1161. No calling parameters are required.
  1162.  
  1163.  
  1164. FREESPACE
  1165.  
  1166. You must supply the drive number of the diskette or fixed-disk which you
  1167. want to test (1 = drive A:, 2 = drive B:, etc). Pass a value of zero to
  1168. test the currently-logged or default drive. The amount of free space is
  1169. returned in bytes.
  1170.  
  1171. DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  1172.  
  1173. Note:       The return value will not be reliable if the drive being
  1174.             tested has an extended DOS partition which contains more
  1175.             than 32MB of free space.
  1176.  
  1177.  
  1178. GAMESPORT
  1179.  
  1180. This function checks to see if the host computer is fitted with an adaptor
  1181. for joysticks or a games paddle.
  1182.  
  1183. No calling parameters are required.
  1184.  
  1185. DECLARE FUNCTION GamesPort% ()
  1186.  
  1187. Returns logical TRUE (-1) if a games adaptor is present or FALSE (0) if no
  1188. games adaptor is fitted.
  1189.  
  1190.  
  1191. GRAPRINT
  1192.  
  1193. This routine simply serves as a function despatcher for the various
  1194. graphics text procedures, which can also be called directly. It is
  1195. intended to be called from programs which must run under a variety of
  1196. video adaptors, transferring control to the proper routine for the current
  1197. video mode. The calling program must supply appropriate parameters,
  1198. however.
  1199.  
  1200. DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  1201.                       BYVAL Attr%, BYVAL Scale%)
  1202.  
  1203. GRAPRINT provides a convenient way of displaying text in any of the EGA,
  1204. VGA and MCGA graphics modes (SCREENs 7-13) as well as the 320 x 200 pixel
  1205. 4-colour CGA mode (SCREEN 1) without having to bother about loading
  1206. external font files. It uses the standard character definition tables
  1207. built into your display adaptor, but allows you to scale them up to eight
  1208. times normal size and to specify any combination of foreground and
  1209. background colours supported by the current video mode.
  1210.  
  1211. XLOC%       The horizontal co-ordinate of the top left hand pixel
  1212.             from which the text will begin
  1213.  
  1214. YLOC%       The vertical co-ordinate of the top left hand pixel
  1215.             from which the text will begin
  1216.  
  1217. TEXT$       The string of text to be displayed (up to 63 characters).
  1218.  
  1219. ATTR%       The colour (or display attribute in monochrome modes) to
  1220.             be given to the text. This is calculated by the formula:
  1221.  
  1222.             Colour% = (Background% * 256) + Foreground%
  1223.  
  1224.             The GRATTRIB function (see below) will perform this
  1225.             calculation for you, automatically, using the foreground
  1226.             and background values you supply.
  1227.  
  1228.             Foreground and Background values are in the ranges used
  1229.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  1230.             actual colours displayed depend upon your current PALETTE
  1231.             settings.
  1232.  
  1233.             Note:   supplying a value of -1 for background prevents
  1234.                     background pixels from being changed at all. This
  1235.                     allows text to be blended more naturally into a
  1236.                     complex graphics display, it is not supported in
  1237.                     320 x 200 4-colour mode, however.
  1238.  
  1239. SCALE%      The character size of the text to be displayed. This ranges
  1240.             from 1 to 8, where 1 is standard 80-column text (40-column
  1241.             in SCREEN 7) and 8 multiplies the character size by eight
  1242.             on both the horizontal and vertical axes.
  1243.  
  1244. GRAPRINT can handle both byte-aligned and non byte-aligned characters. The
  1245. x, y co-ordinates you supply do not need to correspond to a row, column
  1246. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  1247. ASCII character set is supported, including foreign symbols and box-
  1248. drawing characters (computers with CGA adaptors must have GRAFTBL loaded
  1249. to access characters above ASCII 127, however).
  1250.  
  1251. Since GRAPRINT does not support clipping, to ensure a clean display you
  1252. must ensure that the text to be output fits within the current screen
  1253. boundaries.
  1254.  
  1255. See also CGATEXT for displaying characters in SCREEN 1, MCGATEXT for
  1256. displaying characters in SCREEN 13 and VGATEXT for displaying text in
  1257. the EGA and VGA video modes (SCREENs 7-12).
  1258.  
  1259.  
  1260. HANDLES
  1261.  
  1262. Returns the number of file handles available in the System File Table
  1263.  
  1264. DECLARE FUNCTION Handles% ()
  1265.  
  1266. The number returned by this function is equivalent to the value given
  1267. to the FILES = statement in your CONFIG.SYS script. Note that the first
  1268. five of these handles are reserved for DOS's internal use.
  1269.  
  1270.  
  1271. HELPMATE
  1272.  
  1273. This routine provides a context-sensitive on-line Help facility for your
  1274. QuickBASIC programs.
  1275.  
  1276. DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  1277.  
  1278. Colour%   is the display attribute to be given to the Help window. If a
  1279.           value of zero is passed, HELPMATE uses default colours which
  1280.           are Black on Cyan for colour screens and inverse video for a
  1281.           monochrome display.
  1282.  
  1283. Title$    is an optional Title for the Help window. If one is supplied
  1284.           it must be no longer than 48 characters so that it can be
  1285.           easily centered in the top row of the window. If Title$ is a
  1286.           null string, HELPMATE uses its' own name as a default.  
  1287.  
  1288. Context%  is the context-sensitive flag. If set to 1, then the routine
  1289.           attempts to load the file specified by ...
  1290.  
  1291. Topic$    A legal DOS filename (up to 8 characters without extension),
  1292.           specifying the name of the Topic file to be displayed. 
  1293.           HelpMate automatically appends the extension '.HLP'.  
  1294.  
  1295. If Context% is not set, (or Topic$ is a null string), then the routine
  1296. displays a list of topics, from which you can make your own selection.
  1297.  
  1298. If Context% is set, HELPMATE will display the first page of the Topic file
  1299. specified, otherwise it begins by  overlaying the current screen with a
  1300. popup window in which is listed those HELP topics available.
  1301.  
  1302. The first topic in the list is highlighted and you can move the highlight
  1303. around the menu with the arrow keys Highlight the topic you want, then
  1304. press the <RETURN> key. The first page of that topic will be displayed in
  1305. the HELP window.
  1306.  
  1307. Page backwards and forwards through the file using the <PG UP> and <PG DN>
  1308. keys. If you page past the end of the file you will be returned to the
  1309. topic list, where you can either select another topic, or press <ESC> to
  1310. return to the QuickBASIC program. On return, the original screen and all
  1311. current variables are restored, intact, and program execution will
  1312. continue with the statement following the procedure call.
  1313.  
  1314. By default, the Toolbox Help system looks for its topic files in a sub-
  1315. directory called HELP, beneath the currently-logged directory. You can,
  1316. however, direct it to look elsewhere for files by setting a HELP variable
  1317. in the DOS environment table
  1318.  
  1319. e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP
  1320.  
  1321. Alternatively, you can use the QuickBASIC ENVIRON statement within your
  1322. program, to point HELPMATE to the appropriate pathname. Remember, though,
  1323. that this method only remains in effect as long as the current program is
  1324. running and that there must be enough environment space available to hold
  1325. the HELP directory pathname.
  1326.  
  1327. A set of example Topic files, for use with the demonstration program,
  1328. DEMON.EXE is supplied with the Assembly-Language ToolBox. You can make
  1329. your own, using any Word Processor or Text Editor which can output plain
  1330. ASCII text (EDLIN will do). If you do so, bear in mind that the HelpMate
  1331. window's maximum page size is 16 rows of 55-column text. The maximum
  1332. number of pages in any one file is 256.
  1333.  
  1334.                              TIP
  1335.  
  1336. When displaying the list of available Topics, HelpMate searches the
  1337. current HELP directory for files with the extension .HLP. However, since
  1338. there is only room for 60 such filenames to be displayed in the menu
  1339. window, any files in excess of this number will be not be listed and are,
  1340. hence, inaccessible. You can, however, read any number of Context-
  1341. sensitive topic files since these are named explicitly in the call to
  1342. HelpMate which loads them. They need not, therefore, appear in the Topic
  1343. list.
  1344.  
  1345. If your application needs to provide a large number of Topic files, it is
  1346. a good idea to hide those which are context-sensitive from normal
  1347. directory searches (you can use the Toolbox Hide function to do this).
  1348. This will not prevent these files from being loaded when called, but it
  1349. does prevent them from appearing in the Topic list which gives you more
  1350. room for those general-purpose topic files which are selected by the user.
  1351.  
  1352. Note:       The \HELP directory on the ToolBox distribution disk
  1353.             contains a number of these hidden files for use by the
  1354.             demonstration program DEMON.EXE.
  1355.  
  1356.  
  1357. HIDE
  1358.  
  1359. Toggles the Hidden bit of the specified file's directory entry, making it
  1360. visible or invisible to directory listings.
  1361.  
  1362. DECLARE SUB Hide (BYVAL Switch%, FileSpec$)
  1363.  
  1364. If SWITCH% = 1 the file is hidden (regardless of whether it is currently
  1365. visible or not), any other value makes the file visible. FileSpec$ is the
  1366. name of the file to be hidden or unhidden. It can include a drive letter
  1367. and directory path but must be an explicit pathname, wildcard characters
  1368. are not allowed.
  1369.  
  1370.  
  1371. INFORM
  1372.  
  1373. Displays the message supplied in a dialogue box and waits for the user to
  1374. press the <ENTER> key before restoring the screen to its' previous state.
  1375.  
  1376. DECLARE SUB Inform (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  1377.  
  1378. ROW%        The top row of the dialogue box when it is displayed. The
  1379.             box is automatically centered within this row, which may be
  1380.             adjusted so that it remains within the screen boundaries.
  1381.  
  1382. MESSAGE$    A string of text comprising the message to be displayed. It
  1383.             must be no longer than 40 characters otherwise it will be
  1384.             truncated to fit inside the display panel.
  1385.  
  1386. ATTR%       The display attribute or colour to be given to the dialogue
  1387.             box. If an argument of zero is supplied, the box is displayed
  1388.             in cyan with a black foreground (colour monitors) or reverse
  1389.             video (monochrome monitors). On colour displays the message
  1390.             text always has a white foreground, no matter what attribute
  1391.             is specified.
  1392.  
  1393. MOUSE%      Should be set to TRUE (-1) or FALSE (0) to indicate if a
  1394.             mouse is available for use. If available, the operator can
  1395.             respond by clicking the left mouse button while the cursor is
  1396.             positioned on the radio button.     
  1397.  
  1398. This procedure is nearly identical to the MISTAKE routine (below) which is
  1399. designed for displaying error messages.
  1400.  
  1401.  
  1402. INT2E
  1403.  
  1404. Provides an interface to the MS-DOS kernel interrupt 2E (hex) service
  1405. which is sometimes called the 'Back Door to the Command Processor'.
  1406.  
  1407. DECLARE SUB Int2E (DosCmd$)
  1408.  
  1409. DosCmd$ can contain any legal MS-DOS command including the name of an
  1410. external program to be executed. 
  1411.  
  1412. INT2E is an alternative to the SHELL command already provided by
  1413. QuickBASIC. It has one advantage, however, in that many commands are
  1414. passed directly to the MS-DOS kernal instead of to a secondary copy
  1415. of the command processor. For example a SET command passed to INT2E
  1416. will set a string in the MS-DOS master environment instead of the
  1417. current program's local environment. Master environment variables
  1418. are preserved when the program terminates and are available to any
  1419. subsequent programs which may be started up.
  1420.  
  1421. If the command you pass is the name of an external command or if it
  1422. requires COMMAND.COM to be loaded then you must make sure that there
  1423. is enough memory available for it to be executed. You can free-up
  1424. memory by using QuickBASIC's SETMEM function with the appropriate
  1425. negative value.
  1426.  
  1427. Be aware that the INT 2Eh service is not documented or supported by
  1428. Microsoft and successful operation cannot be guaranteed. If the
  1429. procedure fails due to there being insufficient memory or for some 
  1430. other reason, no error message will be returned. For this reason,
  1431. the SHELL statement is usually to be preferred for accessing MS-DOS
  1432. functions, since this can be trapped for errors.
  1433.  
  1434. Note that INT2E will only work with genuine versions of Microsoft
  1435. MS-DOS or IBM PC-DOS. It will not work under DR-DOS, Norton NDOS or
  1436. versions of 4DOS prior to 4.0.
  1437.  
  1438.  
  1439. INTERVAL
  1440.  
  1441. Calculate the number of days between two dates supplied as long integer
  1442. Julian numbers. You can use the DAYNUMBER function (see above) to turn
  1443. dates in normal numeric format into Julian numbers and NUMBERDAY (below)
  1444. to convert them back again.
  1445.  
  1446. DECLARE FUNCTION Interval& (First&, Second&)
  1447.  
  1448. This function always returns a positive value, regardless of whether the
  1449. first argument is lower or greater than the second.
  1450.  
  1451.  
  1452. ITPRINT
  1453.  
  1454. Sends the text supplied, to the printer, as a string of italic characters.
  1455. Output begins at the current print position and can, optionally, append a
  1456. carriage-return/linefeed to take the print head to the beginning of a new
  1457. line when finished.
  1458.  
  1459. DECLARE SUB ItPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  1460.  
  1461. Arguments:  Printer%    the parallel port output is to be sent to
  1462.                         (1 = LPT1:, 2 = LPT2:, etc.).
  1463.             Buffer$     the string of text to be printed.
  1464.             NewLine%    set this to a non-zero value if you want 
  1465.                         to move to a new line after printing.
  1466.  
  1467. The routine restores the previous print style or font before it returns
  1468. and does not effect subsequent output to the printer, using the QuickBASIC
  1469. LPRINT or PRINT # statements.
  1470.  
  1471. Note:       The version of this routine stored in the Toolbox
  1472.             library is for EPSON compatible printers. If you have
  1473.             an IBM graphics printer or ProPrinter, then you should
  1474.             rebuild your libraries, using either the PRINTIBM.OBJ
  1475.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  1476.  
  1477.  
  1478. KEYFLAGS
  1479.  
  1480. Returns a 16-bit unsigned number which is bit-encoded with the current
  1481. status of the CTRL, ALT, INSERT and other keyboard control keys.
  1482.  
  1483. No calling parameters are required.
  1484.  
  1485. DECLARE FUNCTION KeyFlags% ()
  1486.  
  1487. The BITTEST function (see below) can be used to isolate individual bits of
  1488. the returned value. Their meanings are as follows:
  1489.  
  1490.  F E D C B A 9 8 7 6 5 4 3 2 1 0   Bits
  1491. ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
  1492. │0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│  Meaning if set
  1493. └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
  1494.  │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─  Left & Right SHIFT keys pressed
  1495.  │ │ │ │ │ │ │ │ │ │ │ │ │ └─────  CTRL key pressed
  1496.  │ │ │ │ │ │ │ │ │ │ │ │ └───────  ALT key pressed
  1497.  │ │ │ │ │ │ │ │ │ │ │ └─────────  SCROLL LOCK active
  1498.  │ │ │ │ │ │ │ │ │ │ └───────────  NUM LOCK active
  1499.  │ │ │ │ │ │ │ │ │ └─────────────  CAPS LOCK active
  1500.  │ │ │ │ │ │ │ │ └───────────────  INSERT key status
  1501.  │ │ │ │ │ │ │ └─────────────────  Left CTRL key pressed
  1502.  │ │ │ │ │ │ └───────────────────  Left ALT key pressed
  1503.  │ │ │ │ │ └─────────────────────  SYS REQ key pressed
  1504.  │ │ │ │ └───────────────────────  PAUSE (or CTRL-NUM LOCK) active 
  1505.  │ │ │ └─────────────────────────  SCROLL LOCK pressed
  1506.  │ │ └───────────────────────────  NUM LOCK pressed
  1507.  │ └─────────────────────────────  CAPS LOCK pressed
  1508.  └───────────────────────────────  INSERT key pressed
  1509.  
  1510. See the CAPSLOCK, NUMLOCK and SCRLOCK functions for a method of setting or
  1511. reading the status of specific control keys.
  1512.  
  1513.  
  1514. KEYFLUSH
  1515.  
  1516. This procedure flushes the keyboard type-ahead buffer and discards any
  1517. keystrokes which have not yet been processed.
  1518.  
  1519. No calling parameters are required.
  1520.  
  1521. DECLARE SUB KeyFlush ()
  1522.  
  1523. Note:       KEYFLUSH may not work properly if you have installed
  1524.             keystroke enhancement software which moves the type-ahead
  1525.             buffer to another location in memory. It DOES work with
  1526.             command-line buffers like IBM's DOSEDIT, however.
  1527.  
  1528.  
  1529. KEYIN
  1530.  
  1531. Similar to the QuickBASIC INKEY$ function, except that it waits for a
  1532. keypress instead of returning at once if none is available.
  1533.  
  1534. No calling parameters are required.
  1535.  
  1536. DECLARE FUNCTION KeyIn% ()
  1537.  
  1538. The function returns a numeric value between 0 and 255 which represents
  1539. the ASCII code of the key pressed. If one of the function keys (F1 to F12)
  1540. or a special key such as PAGEUP or one of the cursor arrows is pressed,
  1541. then a negative value is returned. Converting this number to its absolute
  1542. equivalent produces the scan code of the key.
  1543.  
  1544. Example:  KeyPress% = KeyIn%
  1545.           IF KeyPress% < 0 THEN
  1546.              ScanCode% = ABS(KeyPress%)
  1547.           ELSE
  1548.              AsciCode% = KeyPress%
  1549.           END IF
  1550.  
  1551. See the ASCICODE topic for a list of ASCII codes and their equivalent
  1552. printable characters. The SCANCODE topic lists the scan codes returned by
  1553. the various function and control keys.
  1554.  
  1555. The KEYIN function will recognise if one of the new 101/102 extended
  1556. keyboards is being used and return the correct scan codes for the extra
  1557. keys such as F11 and F12.
  1558.  
  1559.  
  1560. KEYSTAT
  1561.  
  1562. This function tests to see if a keystroke is waiting to be read. It does
  1563. not read or remove the keystroke from the typeahead buffer, use KEYIN% or
  1564. INKEY$ to do this.
  1565.  
  1566. No calling parameters are required.
  1567.  
  1568. DECLARE FUNCTION KeyStat% ()
  1569.  
  1570. KEYSTAT returns -1 (logical TRUE) if a keystroke is waiting to be
  1571. collected or 0 (logical FALSE) if the typeahead buffer is empty.
  1572.  
  1573.  
  1574. LPTSWAP
  1575.  
  1576. This procedure swaps the port addresses of the two printer channels
  1577. specified so that, for example, all output targeted to LPT1: will actually
  1578. be sent to LPT4:, and vice-versa.
  1579.  
  1580. DECLARE SUB LptSwap (BYVAL Printer1%, BYVAL Printer2%)
  1581.  
  1582. Printer1% and Printer2% are both numeric values in the range 1 - 4, where
  1583. 1 = LPT1:, 2 = LPT2:, etc.
  1584.  
  1585. Note:       any changes made using LPTSWAP will remain in effect 
  1586.             even after your program is finished.
  1587.  
  1588.  
  1589. MATHSCHIP
  1590.  
  1591. Checks to see if a floating-point maths co-processor is installed in the
  1592. system. 
  1593.  
  1594. No calling parameters are required.
  1595.  
  1596. DECLARE FUNCTION MathsChip% ()
  1597.  
  1598. MATHSCHIP returns 0 (logical FALSE) if no co-processor is available. A
  1599. non-zero value indicates that a co-processor is available and, in this
  1600. case, the function will attempt to identify it. Possible return values
  1601. are:
  1602.  
  1603.      87 =   Intel 8087
  1604.     287 =   Intel 80287
  1605.     387 =   Intel 80387 (or 80486 with built-in maths processor)
  1606.  
  1607. Waitek and other models return the same values as their Intel equivalents.
  1608.  
  1609.  
  1610. MCGACOPY
  1611.  
  1612. Copies an MCGA screen to or from a user-supplied dynamic array.
  1613.  
  1614. DECLARE SUB McgaCopy (BYVAL Switch%, SEG Array)
  1615.  
  1616. SWITCH%     Direction of copy   0 = copy screen to string
  1617.                                 1 = copy string to screen
  1618.  
  1619. ARRAY       Dynamic INTEGER or LONG integer array to hold the screen
  1620.             image. It must contain at least 64000 bytes of storage
  1621.             (32000 elements for INTEGER or 16000 for LONG) or the
  1622.             routine will fail, with possibly disastrous results.
  1623.  
  1624. Note:       It is not enough just to pass the name of the storage
  1625.             array to MCGACOPY. You must explicitly name the element
  1626.             where screen storage is to start, eg:
  1627.  
  1628.             DIM ScreenArray(1 TO 32000) AS INTEGER
  1629.             SCREEN 13
  1630.                 .
  1631.             draw some stuff
  1632.                 .
  1633.             McgaCopy 0, ScreenArray(1)
  1634.  
  1635.  
  1636. The QuickBASIC PCOPY statement is very useful for storing screen pages in
  1637. memory, so that they can be kept out of sight until needed. Unfortunately
  1638. it only works in text modes or, on computers with EGA or VGA video cards,
  1639. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  1640. the MCGA display mode (SCREEN 13), it provides a useful alternative to the
  1641. PCOPY statement for use with medium-resolution 256-colour screens.
  1642.  
  1643. See CGACOPY for a version that can be used with SCREEN 1 and 2 displays.
  1644.  
  1645.  
  1646. MCGASCROLL
  1647.  
  1648. Scrolls a rectangular portion of a SCREEN 13 (320 x 200 256-colour)
  1649. display one pixel to the left or right, wrapping those pixels which are
  1650. scrolled out at the end round to the beginning again.
  1651.  
  1652. DECLARE SUB McgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  1653.                         BYVAL yPixels%, BYVAL Direction%)                 
  1654.  
  1655. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  1656.             the rectangle to be scrolled.
  1657.  
  1658. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  1659.             the rectangle to be scrolled.
  1660.  
  1661. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  1662.  
  1663. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  1664.  
  1665. DIRECTION%  The direction in which the rectangle contents are to be
  1666.             scrolled (0 = Left, 1 = Right).
  1667.  
  1668. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  1669.  
  1670.  
  1671. MCGATEXT
  1672.  
  1673. Writes characters to the screen in the 320 x 200  256-colour graphics
  1674. mode (SCREEN 13).
  1675.  
  1676. DECLARE SUB McgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  1677.                       BYVAL Attr%, BYVAL Scale%)
  1678.  
  1679. This routine provides a convenient way of displaying text in SCREEN 13
  1680. without having to bother about loading external font files. It uses the
  1681. standard character definition tables built into your display adaptor, but
  1682. allows you to scale them up to eight times normal size and to specify any
  1683. combination of foreground and background colours.
  1684.  
  1685. XLOC%       The horizontal co-ordinate of the top left hand pixel
  1686.             from which the text will begin (0 - 319).
  1687.  
  1688. YLOC%       The vertical co-ordinate of the top left hand pixel
  1689.             from which the text will begin (0 - 199).
  1690.  
  1691. TEXT$       The string of text to be displayed (up to 63 characters).
  1692.  
  1693. ATTR%       The colour (or display attribute in monochrome modes) to
  1694.             be given to the text. This is calculated by the formula:
  1695.  
  1696.             Colour% = (Background% * 256) + Foreground%
  1697.  
  1698.             Foreground is in the range (0 - 255) and Background (0 - 64).
  1699.             The actual colours displayed depend upon your current PALETTE
  1700.             settings.
  1701.  
  1702.             Note:   supplying a value of -1 for background prevents
  1703.                     background pixels from being changed at all. This
  1704.                     allows text to be blended more naturally into a
  1705.                     complex graphics display.
  1706.  
  1707. SCALE%      The character size of the text to be displayed. This ranges
  1708.             from 1 to 8, where 1 is standard 40-column text and where 8
  1709.             multiplies the character size by eight on both the horizontal
  1710.             and vertical axes.
  1711.  
  1712. The complete extended ASCII character set is supported, including foreign
  1713. symbols and box-drawing characters.
  1714.  
  1715. Since MCGATEXT does not support clipping, to ensure a clean display you
  1716. must ensure that the text to be output fits within the current screen
  1717. boundaries.
  1718.  
  1719. See also CGATEXT for displaying characters in SCREEN 1 and VGATEXT for
  1720. displaying characters in SCREENs 7-12.
  1721.  
  1722.  
  1723. MISTAKE
  1724.  
  1725. Displays the error message supplied in a dialogue box and waits for the
  1726. operator to press the <ENTER> key before returning, restoring the screen
  1727. to its' previous state.
  1728.  
  1729. DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  1730.  
  1731. ROW%        The top row of the dialogue box when it is displayed. The
  1732.             box is automatically centered within this row, which may be
  1733.             adjusted so that it remains within the screen boundaries.
  1734.  
  1735. MESSAGE$    A string of text comprising the error message to be displayed.
  1736.             It must be no longer than 40 characters otherwise it will be
  1737.             truncated to fit inside the display panel.
  1738.  
  1739. ATTR%       The display attribute or colour to be given to the dialogue box.
  1740.             If an argument of zero is supplied, the box is displayed with
  1741.             bright yellow foreground on a red background (colour monitors)
  1742.             or in reverse video (monochrome monitors). On colour displays the
  1743.             message text is always given a white foreground, no matter what
  1744.             attribute is specified.
  1745.  
  1746. MOUSE%     Should be set to TRUE (-1) or FALSE (0) to indicate if a
  1747.             mouse is available for use. If available, the operator can
  1748.             respond by clicking the left mouse button while the cursor is
  1749.             positioned on the radio button.     
  1750.  
  1751. This routine is a special case of the INFORM dialogue box procedure (see
  1752. above) which can be used for any general-purpose messages which require an
  1753. acknowledgement from the operator.
  1754.  
  1755.  
  1756. MOUSEBORDER
  1757.  
  1758. Sets the maximum and minimum boundaries for mouse movement, both
  1759. horizontally and vertically.
  1760.  
  1761. DECLARE SUB MouseBorder (BYVAL x1%, BYVAL y1%, BYVAL x2%, BYVAL y2%)
  1762.  
  1763. This routine defines a screen rectangle into which the mouse cursor
  1764. is confined. x1% - y1% are the pixel co-ordinates of the upper-left
  1765. corner and x2% - y2% the pixel co-ordinates of the lower-right. If
  1766. the upper-left co-ordinates are greater than the lower-right then
  1767. the two sets of values will be swapped.
  1768.  
  1769. If the current mouse pointer is outside the defined rectangle, then
  1770. it will be moved inside it.
  1771.  
  1772.  
  1773. MOUSEHIDE
  1774.  
  1775. Make the mouse cursor invisible. 
  1776.  
  1777. DECLARE SUB MouseHide ()
  1778.  
  1779.  
  1780. MOUSEINIT
  1781.  
  1782. Initialises the mouse driver and returns the driver status. Also hides
  1783. the mouse cursor if it was previously visible.
  1784.  
  1785. DECLARE FUNCTION MouseInit% ()
  1786.  
  1787. Returns TRUE (-1) if mouse support is available or FALSE (0) if not.
  1788.  
  1789.  
  1790. MOUSEMICKEY
  1791.  
  1792. Read mouse motion counters.
  1793.  
  1794. Return the number of horizontal and vertical mickeys moved since the
  1795. last mouse function call.
  1796.  
  1797. DECLARE SUB MouseMickey (horizontal%, vertical%)
  1798.  
  1799. The returned values represent the net mouse pointer displacement since
  1800. this routine was last called. A positive number indicates movement to
  1801. the right or downward. Negative values indicate travel to the left or
  1802. upwards. One mickey is approximately 1/200" of mouse movement.
  1803.  
  1804.  
  1805. MOUSENOW
  1806.  
  1807. Returns the current state of the mouse.
  1808.  
  1809. DECLARE SUB MouseNow (leftButton%, rightButton%, xMouse%, yMouse%)
  1810.  
  1811. If leftButton% or rightButton% are TRUE (-1) than that button is
  1812. currently being pressed, otherwise they are set to FALSE (0).
  1813. xMouse% and yMouse% contain the current horizontal and vertical 
  1814. pixel co-ordinates of the mouse pointer.
  1815.  
  1816.  
  1817. MOUSEPRESSLEFT
  1818.  
  1819. Returns the mouse state at the last press of the left button.
  1820.  
  1821. DECLARE SUB MousePressLeft (leftCount%, xMouse%, yMouse%)
  1822.  
  1823. leftCount% returns the number of presses that have been made on the 
  1824. left mouse button since this routine was last called. xMouse% and
  1825. yMouse% contain the horizontal and vertical pixel co-ordinates of
  1826. the mouse pointer at the last button press (left or right).
  1827.  
  1828. Calling this procedure resets the left button press counter to zero.
  1829.  
  1830.  
  1831. MOUSEPRESSRIGHT
  1832.  
  1833. Returns the mouse state at the last press of the right button.
  1834.  
  1835. DECLARE SUB MousePressRight (rightCount%, xMouse%, yMouse%)
  1836.  
  1837. rightCount% returns the number of presses that have been made on the 
  1838. right mouse button since this routine was last called. xMouse% and
  1839. yMouse% contain the horizontal and vertical pixel co-ordinates of
  1840. the mouse pointer at the last button press (left or right).
  1841.  
  1842. Calling this procedure resets the right button press counter to zero.
  1843.  
  1844.  
  1845. MOUSEPUT
  1846.  
  1847. Sets the mouse cursor position.
  1848.  
  1849. DECLARE SUB MousePut (BYVAL xMouse%, BYVAL yMouse%)
  1850.  
  1851. xMouse% and yMouse% are the horizontal and vertical pixel co-ordinates
  1852. of the screen location where the mouse pointer is to be moved. This
  1853. position is adjusted, if necessary, to lie within the limits specified
  1854. by a previous call to MOUSEBORDER (see above).
  1855.  
  1856.  
  1857. MOUSERELLEFT
  1858.  
  1859. Returns the mouse state at the last release of the left mouse button.
  1860.  
  1861. DECLARE SUB MouseRelLeft (leftCount%, xMouse%, yMouse%)
  1862.  
  1863. leftCount% returns the number of times the left mouse button has been
  1864. released since this procedure was last called. xMouse% and yMouse%
  1865. contain the horizontal and vertical pixel co-ordinates of the mouse
  1866. pointer at the last button release (left or right).
  1867.  
  1868. Calling this routine resets the left button release counter to zero.
  1869.  
  1870.  
  1871. MOUSERELRIGHT
  1872.  
  1873. Returns the mouse state at the last release of the right mouse button.
  1874.  
  1875. DECLARE SUB MouseRelRight (rightCount%, xMouse%, yMouse%)
  1876.  
  1877. rightCount% returns the number of times the right mouse button has been
  1878. released since this procedure was last called. xMouse% and yMouse%
  1879. contain the horizontal and vertical pixel co-ordinates of the mouse
  1880. pointer at the last button release (left or right).
  1881.  
  1882. Calling this routine resets the right button release counter to zero.
  1883.  
  1884.  
  1885. MOUSERESTORE
  1886.  
  1887. Restores the mouse pointer to the position and state that was in
  1888. effect at the previous call to MOUSESAVE (see below).
  1889.  
  1890. DECLARE SUB MouseRestore ()
  1891.  
  1892.  
  1893. MOUSESAVE
  1894.  
  1895. Saves the current mouse pointer state and screen location in an
  1896. internal buffer.
  1897.  
  1898. DECLARE SUB MouseSave ()
  1899.  
  1900. The MOUSERESTORE procedure (see above) can be used to restore
  1901. the mouse pointer state.
  1902.  
  1903.  
  1904. MOUSESHOW
  1905.  
  1906. Makes the mouse cursor visible.
  1907.  
  1908. DECLARE SUB MouseShow ()
  1909.  
  1910.  
  1911. MOUSESPEED
  1912.  
  1913. Sets the mouse mickeys to pixels ratio.
  1914.  
  1915. DECLARE SUB MouseSpeed (BYVAL horizontal%, BYVAL vertical%)
  1916.  
  1917. Sets the number of mickeys that are equivalent to 8 screen pixels for
  1918. horizontal and vertical mouse movement. One mickey is approximately
  1919. 1/200" of physical mouse motion.
  1920.  
  1921.  
  1922. MOUSEWARP
  1923.  
  1924. Set the double-speed threshold.
  1925.  
  1926. DECLARE SUB MouseWarp (BYVAL threshold%)
  1927.  
  1928. Defines the threshold for doubling the speed of mouse pointer travel.
  1929. The threshold% value is supplied in mickeys/second (default = 64).
  1930. Doubling of pointer speed can be effectively disabled by setting the
  1931. threshold to a very large value (such as 32,767).
  1932.  
  1933.  
  1934. NETTEST
  1935.  
  1936. This function is used to detect if the program which calls it is running
  1937. under a Novell Network. It can be used to decide if file or record locking
  1938. is required.
  1939.  
  1940. No calling parameters are required.
  1941.  
  1942. DECLARE FUNCTION NetTest% ()
  1943.  
  1944. Returns -1 (logical TRUE) if the Network shell is present and 0 (logical
  1945. FALSE) if not. Note that the function cannot distinguish between programs
  1946. running on a local or network drive under NetWare.
  1947.  
  1948. The SHARING function (below) provides similar information for file-sharing
  1949. using DOS's SHARE.EXE program.
  1950.  
  1951.  
  1952. NUMBERDAY
  1953.  
  1954. Splits a Julian date number into day, month and year and also returns the
  1955. day of the week as a number between 0 and 6 (0 = Sunday etc..)
  1956.  
  1957. DECLARE FUNCTION NumberDay% (Number&, Day%, Month%, Year%)
  1958.  
  1959.  
  1960. NUMLOCK
  1961.  
  1962. Toggles NUM LOCK on or off or, alternatively, reads the current NUM LOCK
  1963. key setting.
  1964.  
  1965. DECLARE FUNCTION NumLock% (BYVAL Switch%)
  1966.  
  1967. Switch% = 0  Turns NUM LOCK off
  1968.         = 1  Turns NUM LOCK on
  1969.  
  1970. Any other value just returns the current NUM status as a logical value
  1971. where -1 (TRUE) means that NUM LOCK is on and 0 (FALSE) means that NUM
  1972. LOCK is off.
  1973.  
  1974.  
  1975. PARALLELPORTS
  1976.  
  1977. This function checks how many hardware printer ports are available. It
  1978. does not check to see if an actual printer is connected to each of them,
  1979. use the PRINTEST or PRINTERSTAT functions (see below) to obtain this
  1980. information.
  1981.  
  1982. No calling parameters are required.
  1983.  
  1984. DECLARE FUNCTION ParallelPorts% ()
  1985.  
  1986.  
  1987. PARKHEADS
  1988.  
  1989. Parks the heads of each fixed disk drive in the system onto the last
  1990. cylinder of the disk, preparatory to powering off.
  1991.  
  1992. DECLARE SUB ParkHeads ()
  1993.  
  1994. This routine only works reliablly on AT class computers and above.
  1995. Using it on an XT may simply cause the computer to 'hang', without
  1996. parking the heads.
  1997.  
  1998.  
  1999. PAUSE
  2000.  
  2001. This routine is used to generate machine-independent timing loops. It
  2002. simply pauses until the specified number of clock ticks have elapsed.
  2003.  
  2004. DECLARE SUB Pause (BYVAL Ticks%)
  2005.  
  2006. There are 18.2 clock ticks per second on all PCs, no matter what the
  2007. processor or processor speed.
  2008.  
  2009.  
  2010. PEEKWORD
  2011.  
  2012. Reads a long integer value from two consecutive bytes of memory.
  2013.  
  2014. DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL Offset&)
  2015.  
  2016. Arguments:  Segment&  = address of memory segment containing the data
  2017.                         to be read.
  2018.             Offset&   = offset address, within the segment of the 
  2019.                         two bytes to be read.
  2020.  
  2021. Returns:    contents of the two consecutive bytes in the form of a
  2022.             long integer value in the range (0 to 65535). 
  2023.  
  2024. Note:       parameters are passed as LONG integers to save you the
  2025.             hassle of having to convert argument values over 32767
  2026.             to negative signed integers. Do not use values greater
  2027.             than 65535, however, or the most significant word will
  2028.             be ignored and the address converted to Modulus 65536.
  2029.  
  2030.             If you supply an offset address of 65535 (0FFFFh) which
  2031.             would cause the second byte to cross a segment boundary,
  2032.             only the lower byte is read and returned as a value
  2033.             between (0 - 255).
  2034.  
  2035. Using QuickBASIC's PEEK function to examine data which lies outside
  2036. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  2037. required and then to reset it afterwards. This function allows you to
  2038. read data, directly, from anywhere in the 1 megabyte of addressable
  2039. RAM space your computer contains. It also reads two adjacent bytes of
  2040. data from the address supplied and converts them to a single integer.
  2041.  
  2042. The PC architecture follows the Intel convention of storing 'words'
  2043. (two-byte values) with the Least Significant part in the lower byte
  2044. (LSB) and the Most Significant (MSB) in the higher byte. Since each
  2045. byte can only hold 256 possible values (0 to 255), an integer which
  2046. has a range of from 0 to 65535 (unsigned) is stored in consecutive
  2047. bytes with the MSB being considered the number of times it can be
  2048. divided by 256 and the LSB being the remainder of this division. The
  2049. number 1000, for example would be stored in memory as follows:
  2050.  
  2051.                          LSB              MSB
  2052.                  ┌─┬─┬─┬─┬─┬─┬─┬─┐ ┌─┬─┬─┬─┬─┬─┬─┬─┐
  2053. 1000 (decimal) = │1│1│1│0│1│0│0│0│ │0│0│0│0│0│0│1│1│
  2054.                  └─┴─┴─┴─┴─┴─┴─┴─┘ └─┴─┴─┴─┴─┴─┴─┴─┘
  2055.  
  2056.                  1000 MOD 256 = 232   1000 \ 256 = 3
  2057.  
  2058. To convert the two bytes back to a single integer again, you would
  2059. use the formula: 
  2060.  
  2061.                         x = (MSB * 256) + LSB 
  2062.  
  2063. or, in our example:     x = 3 * 256 + 232 = 1000
  2064.  
  2065. PEEKWORD makes this conversion for you automatically, all you have to
  2066. do is supply the address and it returns the contents of the two bytes
  2067. in long integer format.
  2068.  
  2069. The POKEWORD procedure (below) complements PEEKWORD by allowing you
  2070. to write a word of data anywhere in the 1MB addressable PC workspace.
  2071.  
  2072. See also FARPEEK and FARPOKE which allow you to read from and write
  2073. to far memory, one byte at a time.
  2074.  
  2075.  
  2076. PERCENTBOX
  2077.  
  2078. Opens and maintains a popup window which displays a percentage value
  2079. as a horizontal bar.
  2080.  
  2081. DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%,_
  2082.                         BYVAL PerCent%)
  2083.  
  2084. Arguments:  Switch%   = 1  open percentage box window
  2085.                       = 2  maintain percentage bar
  2086.                       = 3  close percentage box
  2087.                       
  2088.             Message$  = an optional message which is centred in the
  2089.                         percentage box window (Switch% = 1).
  2090.                         
  2091.             Attr%     = display colour or attribute for percentage
  2092.                         box window and text. If Attr% = 0 attribute
  2093.                         defaults to 48 (Black on Cyan) for colour
  2094.                         adaptors and 112 (Reverse) for monochrome.
  2095.                         (used only with Switch% = 1)
  2096.                         
  2097.             PerCent%  = an integer value between 0 and 100 which
  2098.                         controls the length of the percentage bar.
  2099.                         (used only with Switch% = 2)            
  2100.  
  2101. Here is another useful little routine for Toolbox users. It pops up a
  2102. window in which is displayed a percentage bar, illustrating how much
  2103. of the current process has been completed. Use it, during lengthy
  2104. operations, to reassure an operator that the program is not 'hanging',
  2105. or to indicate how much longer there is to go.
  2106.  
  2107. The Percentage Box window is popped up, centered, on the screen. It
  2108. recognises 43 and 50 line displays and will adjust itself accordingly.
  2109. Only one Percentage Box can be open at a time, although other windows
  2110. and dialogue boxes may be opened and closed while it is present. Be
  2111. careful not to overlap the Percentage Box with other windows, though.
  2112.  
  2113.  
  2114. POKEWORD
  2115.  
  2116. Writes an integer value into two consecutive bytes of memory.
  2117.  
  2118. DECLARE SUB PokeWord (BYVAL Segment&, BYVAL Offset&, BYVAL Word&)
  2119.  
  2120. Arguments:  Segment&  = address of memory segment containing the
  2121.                         location to be written to
  2122.             Offset&   = offset address, within the segment of the 
  2123.                         two bytes to be set.
  2124.             Word&     = the value to set in memory. It must be a
  2125.                         value in the range 0 to 65535.
  2126.  
  2127. The data is written in standard Intel format, with the Most
  2128. Significant part of the number (MSB) being written into the higher
  2129. of the two bytes.
  2130.  
  2131. Note:       if you supply an offset address of 65535 (0FFFFh) which
  2132.             would cause the second byte to cross a segment boundary,
  2133.             only the lower, least significant, byte (LSB) is written.
  2134.  
  2135.             Parameters are passed as LONG integers to save you the
  2136.             hassle of having to convert argument values over 32767
  2137.             to negative signed integers. Do not use values greater
  2138.             than 65535, however, or the most significant word will
  2139.             be ignored and the address converted to Modulus 65536.
  2140.  
  2141. The PEEKWORD procedure (above) complements POKEWORD by allowing you
  2142. to read a word of data from anywhere in the 1MB of addressable PC
  2143. memory.
  2144.  
  2145. See also FARPEEK and FARPOKE which allow you to read from and write
  2146. to far memory, one byte at a time.
  2147.  
  2148.  
  2149. POPUP
  2150.  
  2151. This is the Toolbox popup window generator. What are Windows?  Well if
  2152. you've used the QuickBASIC environment at all then you've used Windows.
  2153. When you press <ALT><F> to bring down the File Menu, the list of options
  2154. presented there is in a window. Notice how any characters which were
  2155. concealed when the File Menu appeared, are restored, intact, after you've
  2156. made your choice. Windows are areas of the screen which are used to hold
  2157. transient data and messages to the user. They make the most of the limited
  2158. display space available and remove the need to constantly rebuild the
  2159. screen, each time your program communicates with the world.
  2160.  
  2161. Properly  presented, windows can give the illusion of multi-tasking, even
  2162. on single-processor machines like the IBM-PC.
  2163.  
  2164. Nowadays, no program worth its' salt can be without a window of some kind.
  2165. If YOUR program is going to stand out amongst all the others, however,
  2166. they've got to be done professionally. Windows must appear instantly and
  2167. vanish, just as quickly, when no longer required. They must be as large or
  2168. as small as is necessary, for the data which you need to display, and you
  2169. should have a plentiful supply, for all the circumstances that your
  2170. program might encounter. BASIC, unfortunately, is just not fast enough to
  2171. meet all these requirements.
  2172.  
  2173. Looks like it'll have to be Assembly-Language again ...
  2174.  
  2175. DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%,_
  2176.                    BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  2177.  
  2178. Opens a popup window at the screen location specified.
  2179.  
  2180. Where:    P1%  is the top-left row co-ordinate
  2181.           P2%  is the top-left column co-ordinate
  2182.           P3%  is the height (in rows) of the window
  2183.           P4%  is the width (in columns) of the window
  2184.           P5%  is the display attribute or colour
  2185.           P6%  is the border style (0 = no border)
  2186.           P7%  is the shadow switch (0 = no shadow)
  2187.           P8%  is the zoom switch (0 = no zoom)
  2188.  
  2189. The first four parameters specify the size of the window and the location
  2190. on the screen at which it will appear. Border styles are as follows:
  2191.  
  2192. ┌────┐
  2193. │ 1. │    Single-lined box all round the window
  2194. └────┘
  2195. ╔════╗
  2196. ║ 2. ║    Double-lined box all round the window
  2197. ╚════╝
  2198. ╒════╕
  2199. │ 3. │    Single vertical, double horizontal
  2200. ╘════╛
  2201. ╓────╖
  2202. ║ 4. ║    Single horizontal, double vertical
  2203. ╙────╜
  2204. ╤════╤
  2205. │ 5. │    Single-lined box all round the window
  2206. ╘════╛
  2207. ╦════╦
  2208. ║ 6. ║    Double-lined box all round the window
  2209. ╚════╝
  2210. ┬────┬
  2211. │ 7. │    Single vertical, double horizontal
  2212. ╘════╛
  2213. ╥────╥
  2214. ║ 8. ║    Single horizontal, double vertical
  2215. ╙────╜
  2216.  
  2217. Border styles 5 through 8 are particularly suitable for use with pull-
  2218. down menus, descending from a horizontal bar.
  2219.  
  2220. The SHADOW switch (Parameter 7), can be used to add a black shadow beneath
  2221. your window, Giving it a three dimensional effect. Setting P7% to 1 puts
  2222. solid shadow on the left-hand side. Setting P7% to 2 puts it on the right.
  2223. values of 3 and 4 in P7% will display transparant shadow to the left or
  2224. right, respectively, any other value prevents shadow.
  2225.  
  2226. Setting Parameter 8 to a non-zero value will cause the window to ZOOM onto
  2227. the screen.  What this means is that, starting at a point source,
  2228. successively larger versions of the window will be drawn until it is the
  2229. size required. The value you supply sets the interval, in milliseconds,
  2230. between iterations and is used to control the speed at which the window
  2231. explodes onto the screen. 
  2232.  
  2233. To preserve compatibility with programs written for use with previous
  2234. versions of the Toolbox, a value of 1 in parameter 8 sets the default
  2235. delay of 20 milliseconds per iteration. At this speed, which is constant
  2236. on PCs with all types of microprocessor, the process is extremely fast
  2237. and impressive, and adds a very professional touch to your programs. 
  2238.  
  2239. Before a window is opened, the display area below it is copied to an
  2240. internal buffer, from where it will be eventually restored when the window
  2241. is closed. This buffer has a capacity of 8 KiloBytes, the equivalent of
  2242. two full screens. To calculate the storage required for a particular
  2243. window, use the formula:
  2244.  
  2245. Bytes = ((Height in rows * Width in columns) * 2) + 6
  2246.  
  2247. (add one row to the height and one column to the width if you specify
  2248. shadow)
  2249.  
  2250. The window area needs to be multiplied by 2 since each screen character
  2251. takes two bytes of memory, for itself and its attribute code. The odd six
  2252. bytes are required for the storage of buffer pointers. The window buffer
  2253. works as a LIFO (Last In First Out) stack, so that the last window opened
  2254. is the first one to be removed. You can close the current window with the
  2255. statement:
  2256.  
  2257. CALL ShutUp
  2258.  
  2259. To put text inside a window, use the FASTPRINT routine (see above). You
  2260. can clear all or part of an open window with SCROLL (see below).
  2261.  
  2262.  
  2263. PRINTERSTAT
  2264.  
  2265. DECLARE FUNCTION PrinterStat% (BYVAL Printer%)
  2266.  
  2267. This function tests the current status of the parallel printer specified.
  2268. The value returned is tested as follows :
  2269.  
  2270.    Bit     Wanted    Meaning
  2271. ─────────────────────────────────────────────────────
  2272.     7        1       Printer not busy (0 = busy)
  2273.     6        0       Printer acknowledges
  2274.     5        0       Out-of-paper
  2275.     4        1       This printer selected
  2276.     3        0       I/O error
  2277.     2        0       Not used
  2278.     1        0       Not used
  2279.     0        0       Time-out occurred
  2280. ─────────────────────────────────────────────────────
  2281.    90 Hex  144 (Decimal)
  2282.  
  2283. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2284. LPT1:, 2 = LPT2:, etc.
  2285.  
  2286. Note:       Some printers also set the acknowledgement bit. If so, the
  2287.             value returned will be 208 (D0 Hex) instead of 144.
  2288.  
  2289.  
  2290. PRINTEST
  2291.  
  2292. This is a simplified version of the PRINTERSTAT function (above). It
  2293. returns a logical value to indicate whether the specified printer is ready
  2294. (TRUE = -1) or not (FALSE = 0).
  2295.  
  2296. DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  2297.  
  2298. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2299. LPT1:, 2 = LPT2:, etc. The function will only work with parallel printers.
  2300.  
  2301.  
  2302. PRINTSET
  2303.  
  2304. Most modern printers have a variety of useful styles and fonts which you
  2305. can select by setting dip switches or sending the appropriate control
  2306. codes from the computer. Unfortunately this is not always convenient,
  2307. especially when you are in the middle of a program and have to duck out to
  2308. set up the proper print size. PRINTSET offers a solution to this problem
  2309. in the form of a pull-down menu which allows you to select from a range of
  2310. printer features, using the 'point-and-shoot' method.
  2311.                                                     
  2312. DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%, BYVAL Printer%)
  2313.  
  2314. Where:  Row%     = Row number of the top left-hand corner of the menu
  2315.                    window.
  2316.         Col%     = Column number of the top left-hand corner of the menu
  2317.                    window. 
  2318.         Attr%    = the display attribute or colour which is given to the
  2319.                    menu window.
  2320.         Printer% = the printer number (i.e. 1 = LPT1, 2 = LPT2 etc).
  2321.  
  2322. If you supply a value of zero for the Attr% argument, the menu window will
  2323. take the colour or attribute of the character which will be overlaid by
  2324. the top left corner of the window, when it appears. If this character is
  2325. also a single or double-lined horizontal bar (ASCII 196 or 205), the
  2326. border of the menu will be automatically adjusted to blend in with this
  2327. line, allowing you to produce the appearance of a pulldown menu.
  2328.  
  2329. Note:       Although the Toolbox package contains copies of this module
  2330.             configured for different types of printer, only one version
  2331.             of PrintSet may be in the library at any one time.
  2332.  
  2333.             PRINTEPS.OBJ is for Epson printers
  2334.             PRINTIBM.OBJ is for IBM Grahics printers
  2335.             PRINTPRO.OBJ is for IBM Proprinters
  2336.  
  2337.  
  2338. RAMDISK
  2339.  
  2340. Many disk-intensive processes, such as file sorting, will run much faster
  2341. when performed on a ramdisk. In such cases, use this function to test if a
  2342. ramdisk is available and the FREESPACE function (above) to see if it has
  2343. enough space for the job required. Don't forget to copy your data back to
  2344. a physical drive afterwards, or you will lose it when you power off.
  2345.  
  2346. RAMDISK searches the system drive table and examines the device driver for
  2347. each block device to see if it is a ramdisk. If one is detected, the
  2348. function returns the ASCII value of the drive letter associated with it
  2349. (eg 68 = D:). If no ramdisk is present, a value of zero is returned. If
  2350. more than one ramdisk is present in the system, only the first one is
  2351. reported on.
  2352.  
  2353. No calling parameters are required.
  2354.  
  2355. DECLARE FUNCTION RamDisk% ()
  2356.  
  2357. RAMDISK will work reliably with all versions of Microsoft's RAMDRIVE and
  2358. IBM's VDISK. However it has not been tested with any of the more esoteric
  2359. virtual disk products, and may not correctly identify some of these.
  2360.  
  2361.  
  2362. RAND
  2363.  
  2364. Returns a random number. This differs from QuickBASIC's RND function in
  2365. that RAND returns an integer and you can specify the range for this value.
  2366.  
  2367. DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  2368.  
  2369. Lower% and Higher% are the upper and lower limits for the random number
  2370. to be returned. If Lower% is greater than Higher% then the arguments will
  2371. be transposed.
  2372.  
  2373.  
  2374. RESEED
  2375.  
  2376. Reinitialises the random number seed used by the RAND function (above).
  2377.  
  2378. DECLARE SUB ReSeed (BYVAL Seed&)
  2379.  
  2380. Note that the argument passed is a LONG integer. This enables you to use
  2381. the value which is returned by the QuickBASIC TIMER function, eg:
  2382.  
  2383.     ReSeed TIMER
  2384.  
  2385. Note that the Toolbox random number seed is not the same as the one used
  2386. internally by QuickBASIC. You cannot, therefore, start a new sequence of
  2387. QB's RND values by using RESEED nor can you use RANDOMIZE to reinitialise
  2388. the sequence for RAND.
  2389.  
  2390. SCREENDUMP
  2391.  
  2392. Copies the contents of the current screen (text mode only) to the line
  2393. printer, just as if the operator had pressed the <Prt Scrn> key.
  2394.  
  2395. No calling parameters are required.
  2396.  
  2397. DECLARE SUB ScreenDump ()
  2398.  
  2399. Includes support for 43 and 50-line screens on EGA and VGA adaptors.
  2400.  
  2401. This routine will not work if screen print has previously been disabled by
  2402. a call to the DISABLEPRTSC routine (see above) or if the parallel printer
  2403. at LPT1: is not ready.
  2404.  
  2405.  
  2406. SCREENROWS
  2407.  
  2408. Returns the height of the current screen, in rows, as set by the last
  2409. WIDTH statement (default = 25).
  2410.  
  2411. No calling parameters are required.
  2412.  
  2413. DECLARE FUNCTION ScreenRows% ()
  2414.  
  2415. The number returned may be 25, 43 or 50, depending on the capabilities of
  2416. your display adaptor.
  2417.  
  2418.  
  2419. SCREENWIDTH
  2420.  
  2421. Returns the width of the current screen, in columns, as set by the last
  2422. WIDTH statement.
  2423.  
  2424. No calling parameters are required.
  2425.  
  2426. DECLARE FUNCTION ScreenWidth% ()
  2427.  
  2428. Possible return values are 40 and 80 (default = 80).
  2429.  
  2430.  
  2431. SCRLOCK
  2432.  
  2433. Toggles SCROLL LOCK on or off or, alternatively, reads the current SCROLL
  2434. LOCK key setting.
  2435.  
  2436. DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  2437.  
  2438. Switch% = 0  Turns SCROLL LOCK off
  2439.         = 1  Turns SCROLL LOCK on
  2440.  
  2441. Any other value just returns the current SCROLL status as a logical value
  2442. where -1 (TRUE) means that SCROLL LOCK is on and 0 (FALSE) means that the
  2443. SCROLL LOCK is off.
  2444.  
  2445.  
  2446. SCROLL
  2447.  
  2448. Scrolls the contents of a screen rectangle a specified number of lines or
  2449. columns in the direction indicated, blank spaces of the background colour
  2450. specified are scrolled in to replace them.
  2451.  
  2452. DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  2453.                     BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  2454.  
  2455. Dir%        =  Scroll direction (0 = down, 1 = up, 2 = left, 3 = right).
  2456. Y1%         =  Top-left row of rectangle to be scrolled.
  2457. X1%         =  Top-left column of rectangle.
  2458. Y2%         =  Bottom-right row of rectangle.
  2459. X2%         =  Bottom-right column of rectangle
  2460. Units%      =  Number of rows or columns to scroll.
  2461. Attr%       =  Display attribute of blank spaces scrolled in.
  2462.  
  2463. Notes:      This routine will work in all graphics modes as well as on
  2464.             the text screen. When scrolling the graphics screen up or
  2465.             down, however, the attribute value must be calculated in a
  2466.             different way:
  2467.  
  2468.             On 320 x 200 4-colour and 640 x 200 2-colour displays the
  2469.             attribute represents a 1-byte pixel pattern, which is
  2470.             equivalent to 8 pixels in 2-colour (SCREEN 2) mode and 4
  2471.             pixels in 4-colour (SCREEN 1) mode. This pixel pattern is
  2472.             replicated through all the blank lines scrolled in.
  2473.  
  2474.             In all other EGA, VGA and MCGA display modes, ATTR% is
  2475.             the colour value for each pixel in the blanked lines.
  2476.  
  2477.             Scrolling sideways in graphics modes, using this routine,
  2478.             does not provide sufficiently fine movement for animation
  2479.             effects, but see the CGASCROLL and MCGASCROLL procedures
  2480.             (above) for a more precise alternative.
  2481.  
  2482.  
  2483. SECURE
  2484.  
  2485. Toggles bit zero of the specified file's directory entry, making it either
  2486. Read-only or Read/Write.
  2487.  
  2488. DECLARE SUB Secure (BYVAL Switch%, FileSpec$)
  2489.  
  2490. If SWITCH% = 1 the file is made Read-only (regardless of whether it can be
  2491. currently written to or not), any other value makes the file Read/Write.
  2492. FILESPEC is the name of the file to be hidden or unhidden. It can include
  2493. a drive letter and directory path but must be an explicit pathname,
  2494. wildcard characters are not allowed.
  2495.  
  2496.  
  2497. SERIALPORTS
  2498.  
  2499. This function checks how many serial ports are available, it does not
  2500. check to see if devices are connected to any of them.
  2501.  
  2502. No calling parameters are required.
  2503.  
  2504. DECLARE FUNCTION SerialPorts% ()
  2505.  
  2506.  
  2507. SHARE
  2508.  
  2509. Toggles bit seven of the specified file's directory entry, making it
  2510. either Shareable or Non-shareable. This routine will only work when the
  2511. program which calls it is running under a Novell Network.
  2512.  
  2513. DECLARE SUB Share (BYVAL Switch%, FileSpec$)
  2514.  
  2515. If SWITCH% = 1 the file is made Shareable (regardless of whether it can be
  2516. currently used by other programs or not), any other value makes the file
  2517. Non-shareable. FILESPEC is the name of the file to be shared. It can
  2518. include a drive letter and directory path but must be an explicit
  2519. pathname, wildcard characters are not allowed.
  2520.  
  2521.  
  2522. SHARING
  2523.  
  2524. Reports if SHARE.EXE, the MS-DOS file sharing support module, is installed
  2525. in memory. No calling parameters are required.
  2526.  
  2527. DECLARE FUNCTION Sharing% ()
  2528.  
  2529. If SHARE is installed the function returns a value of -1 (logical TRUE),
  2530. otherwise zero (logical FALSE) is returned.
  2531.  
  2532. Note:   for some reason this function does not return reliable results
  2533.         when called in the QuickBASIC environment, although it works
  2534.         fine in stand-alone programs. Does QB[X] disable SHARE then?
  2535.         
  2536. The NETTEST function (above) returns similar information for file sharing
  2537. under a Novell Network.
  2538.  
  2539.  
  2540. SHUTUP
  2541.  
  2542. Closes the last window opened by the POPUP window procedure (see above)
  2543. and restores the contents of the screen below it.
  2544.  
  2545. DECLARE SUB ShutUp (BYVAL Speed%)
  2546.  
  2547. The Speed% parameter is a delay in milliseconds. If greater than zero
  2548. it produces the effect of imploding the storage buffer contents onto the
  2549. screen, making the window appear to vanish into a point source.
  2550.  
  2551.  
  2552. FILESIZE
  2553.  
  2554. This function will return the size of the file specified in bytes, or, if
  2555. more than one match is found, the total size of all such files. If a size
  2556. of zero is returned, no matching file exists (at least not in the
  2557. directory specified).
  2558.  
  2559. DECLARE FUNCTION FileSize& (FileSpec$)
  2560.  
  2561. The filename can include a directory path and may be ambiguous, using the
  2562. wildcard characters '*' and '?'.
  2563.  
  2564. Note:   In previous versions of the Toolbox this function was called
  2565.         SIZEOF. In MASM 6, however, SIZEOF is now a reserved word so the
  2566.         name has had to be changed.
  2567.  
  2568. SOUNDEX
  2569.  
  2570. Gets the phonetic equivalent of a string. This function returns a long
  2571. integer which represents the 'sound' of a string of text using the SOUNDEX
  2572. phonetic conversion algorithm. It can be used in 'fuzzy' searches, for
  2573. example, to scan a database for an individual when you are not sure of the
  2574. exact spelling of their surname. When searching for SMITH, for instance,
  2575. SOUNDEX would also match SMYTH and SMYTHE.
  2576.  
  2577. DECLARE FUNCTION Soundex& (Text$)
  2578.  
  2579. Note that the initial letter of the search string must exactly match the
  2580. initial letter of the target. GAMMELL and CAMMEL will return different
  2581. values when passed to SOUNDEX. Note also that the function will only
  2582. convert the first word of the string, translation stops at the first
  2583. blank space.
  2584.  
  2585.  
  2586. SPOOLER
  2587.  
  2588. Gets the installed state of the DOS print spooler, PRINT.COM, so that a
  2589. program can check if it is safe to submit files to the print queue.
  2590.  
  2591. No calling parameters are required.
  2592.  
  2593. DECLARE FUNCTION Spooler% ()
  2594.  
  2595. Returns:    -1  if spooler is installed
  2596.              0  if spooler is not installed
  2597.  
  2598.  
  2599. SPOOLDELETE
  2600.  
  2601. Deletes one or more files from the current print queue.
  2602.  
  2603. FileSpec$ should include the full pathname of the file to be deleted from
  2604. the print queue. It can be ambiguous, using the DOS wildcard characters
  2605. '*' and '?', allowing you to cancel the processing of a range of files
  2606. with a single command.
  2607.  
  2608. DECLARE SUB SpoolDelete (FileSpec$)
  2609.  
  2610. Note:       This function will only work if PRINT.COM, the DOS print
  2611.             spooler has been installed. You can use the SPOOLER
  2612.             function (see above) to check if PRINT.COM is available.
  2613.  
  2614.  
  2615. SPOOLFLUSH
  2616.  
  2617. Deletes all files from the current print queue and terminates output to
  2618. the printer.
  2619.  
  2620. No calling parameters are required.
  2621.  
  2622. DECLARE SUB SpoolFlush ()
  2623.  
  2624. Note:       This function will only work if PRINT.COM, the DOS print
  2625.             spooler has been installed. You can use the SPOOLER
  2626.             function (see above) to check if PRINT.COM is available.
  2627.  
  2628.  
  2629. SPOOLLIST
  2630.  
  2631. Returns the pathname of a file in the current print queue.
  2632.  
  2633. SPOOLLIST can only be used while printing is suspended after a call to the
  2634. SPOOLSUSPEND function (see below) has been made.
  2635.  
  2636. Buffer$ must be preset to a length of at least 64 bytes for the routine to
  2637. work, although you do not have to fill it with spaces first.  When called,
  2638. immediately after printing has been suspended, SPOOLLIST will return, in
  2639. Buffer$, the pathname of the first file in the spooler print queue.
  2640.  
  2641. Further calls will return the names of subsequent files in the queue until
  2642. a string of blank spaces indicates that all entries have been read.
  2643.  
  2644. DECLARE SUB SpoolList (Buffer$)
  2645.  
  2646. The following example demonstrates how SPOOLLIST, SPOOLSUSPEND and
  2647. SPOOLRESTART can be used in a QuickBASIC program.
  2648.  
  2649.     CONST FALSE = 0, TRUE = NOT FALSE
  2650.  
  2651.     Buffer$ = STRING$(64, "*")
  2652.  
  2653.     Status% = SpoolSuspend%
  2654.     PRINT "Spooler suspended, status is"; Status%
  2655.     PRINT "Files in print queue are ...": PRINT
  2656.     Done% = FALSE: Number% = 1
  2657.     DO
  2658.         SpoolList Buffer$
  2659.         IF Buffer$ = SPACE$(64) THEN
  2660.            Done% = TRUE
  2661.         ELSE
  2662.            PRINT Number%, Buffer$
  2663.            Number% = Number% + 1
  2664.        END IF
  2665.     LOOP UNTIL Done%
  2666.     CALL SpoolReStart
  2667. END
  2668.  
  2669. Use SPOOLRESTART (see below) to resume printing after it has been
  2670. suspended for a listing of the queue contents to be made.
  2671.  
  2672. Note:       This function will only work if PRINT.COM, the DOS print
  2673.             spooler has been installed. You can use the SPOOLER
  2674.             function (see above) to check if PRINT.COM is available.
  2675.  
  2676.  
  2677. SPOOLRESTART
  2678.  
  2679. Re-enables output of spooled files to the printer after it has been
  2680. suspended for a status check or for the queue contents to be listed.
  2681.  
  2682. No calling parameters are required.
  2683.  
  2684. DECLARE SUB SpoolReStart ()
  2685.  
  2686. Note:       This function will only work if PRINT.COM, the DOS print
  2687.             spooler has been installed. You can use the SPOOLER
  2688.             function (see above) to check if PRINT.COM is available.
  2689.  
  2690.  
  2691. SPOOLSUBMIT
  2692.  
  2693. Submits a file for processing by the DOS print spooler. 
  2694.  
  2695. FileSpec$ should contain the full pathname of the file to be printed and
  2696. should be no longer than 64 characters. Wildcard characters are not
  2697. allowed. If found, the file will be added to the end of the current print
  2698. queue.
  2699.  
  2700. DECLARE SUB SpoolSubmit (FileSpec$)
  2701.  
  2702. Note:       This function will only work if PRINT.COM, the DOS print
  2703.             spooler has been installed. You can use the SPOOLER
  2704.             function (see above) to check if PRINT.COM is available.
  2705.  
  2706.  
  2707. SPOOLSUSPEND
  2708.  
  2709. Suspends output from the DOS print spooler and reports if an error has
  2710. been encountered. Printing is suspended until you use the SPOOLRESTART
  2711. procedure (see above) to resume output. 
  2712.  
  2713. No calling parameters are required.
  2714.  
  2715. DECLARE FUNCTION SpoolSuspend% ()
  2716.  
  2717. Returns:     0 = no errors
  2718.              1 = invalid function
  2719.              2 = file not found
  2720.              3 = path not found
  2721.              4 = too many open files
  2722.              5 = access denied
  2723.              8 = queue full
  2724.              9 = spooler busy
  2725.             12 = name too long
  2726.             15 = invalid drive    
  2727.  
  2728. SPOOLLIST (see above), which returns the pathnames of files in the print
  2729. queue, can only be called while the spooler is suspended.
  2730.  
  2731. Note:       This function will only work if PRINT.COM, the DOS print
  2732.             spooler has been installed. You can use the SPOOLER
  2733.             function (see above) to check if PRINT.COM is available.
  2734.  
  2735.  
  2736. STATUSLINE
  2737.  
  2738. This procedure displays the message supplied on the bottom line of the
  2739. display, prompts the user for a keypress, waits until it is received and
  2740. then returns, restoring the screen to its former state. The  ASCII value
  2741. of the keypress is returned in the variable that you assign to the
  2742. function.
  2743.  
  2744. DECLARE FUNCTION StatusLine% (Message$)
  2745.  
  2746. Note:       StatusLine will recognise if an EGA or VGA is installed and
  2747.             will correctly locate itself if the screen is in 43 or 50-
  2748.             line mode.
  2749.  
  2750.  
  2751. STRINGSCAN
  2752.  
  2753. This routine searches a variable-length string array for the string
  2754. specified, returning the element number it occupies if found.
  2755.  
  2756. DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  2757.  
  2758. Arguments:  Trgt$ = target string to be searched for.
  2759.             Size% = number of array elements to be searched.
  2760.             Strt% = array element to start searching at.
  2761.             Addr% = address of start element (the VARPTR value).  
  2762.                      
  2763. See also the STRINGSORT routine (below) for a fast method of sorting a
  2764. variable-length string array.
  2765.  
  2766.  
  2767. STRINGSORT
  2768.  
  2769. This procedure can sort a string array into ascending or descending order,
  2770. very quickly indeed.
  2771.  
  2772. DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  2773.  
  2774. Arguments:  Dir%    = sort direction (0 = ascending, 1 = descending).
  2775.             Size%   = number of elements to sort.
  2776.             Addr%   = VARPTR of element to start sorting from.
  2777.  
  2778. Note:       This routine now works perfectly with Extended QuickBASIC
  2779.             far string arrays, provided that the range of elements to
  2780.             sort are contained within a single 64K segment. If the
  2781.             array extends over more than one segment then no sorting
  2782.             will be performed at all.
  2783.  
  2784.  
  2785. ULPRINT
  2786.  
  2787. Sends the text supplied, to the printer, as a string of underlined
  2788. characters.  Output begins at the current print position and can,
  2789. optionally, append a carriage-return/linefeed to take the print head to
  2790. the beginning of a new line when finished.
  2791.  
  2792. DECLARE SUB UlPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  2793.  
  2794. Arguments:  Printer%    the parallel port output is to be sent to
  2795.                         (1 = LPT1:, 2 = LPT2:, etc.).
  2796.             Buffer$     the string of text to be printed.
  2797.             NewLine%    set this to a non-zero value if you want 
  2798.                         to move to a new line after printing.
  2799.  
  2800. The routine restores the previous print style or font before it returns
  2801. and does not effect subsequent output to the printer, using the QuickBASIC
  2802. LPRINT or PRINT # statements.
  2803.  
  2804. Note:       The version of this routine stored in the Toolbox
  2805.             library is for EPSON compatible printers. If you have
  2806.             an IBM graphics printer or ProPrinter, then you should
  2807.             rebuild your libraries, using either the PRINTIBM.OBJ
  2808.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  2809.  
  2810.  
  2811. VERIFY
  2812.  
  2813. This function opens a dialogue box, centered at the screen row specified,
  2814. in which is displayed a prompt supplied by the caller. The routine adds a
  2815. further Y/N prompt, and then waits for a keypress. Only <Y/N> responses
  2816. (in upper or lower case) are accepted and the value that is returned
  2817. evaluates to Boolean TRUE (-1), if a Y(es) response was entered, and
  2818. Boolean FALSE (0) if the reply was N(o). The screen is restored to its
  2819. previous state on exit from the function.
  2820.  
  2821. DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$,_
  2822.                           BYVAL Attr%, BYVAL Mouse%)
  2823.  
  2824. DEFAULT%    Specifies the radio button to be highlighted as the default
  2825.             response on entry into the function. Pressing <Return> or
  2826.             clicking the left mouse button without moving the pointer
  2827.             will produce the specified response. If DEFAULT% is set to
  2828.             one the YES button is highlighted. Any other value highlights
  2829.             the NO button. 
  2830.  
  2831. ROW%        The top row of the dialogue box when it is displayed. The
  2832.             box is automatically centered within this row, which may be
  2833.             adjusted so that it remains within the screen boundaries.
  2834.  
  2835. PROMPT$     A string of text comprising the message to be displayed. It
  2836.             must be no longer than 40 characters otherwise it will be
  2837.             truncated to fit inside the display panel.
  2838.  
  2839. ATTR%       The display attribute or colour to be given to the dialogue box.
  2840.             If an argument of zero is supplied, the box is displayed with
  2841.             bright white text on a blue background (colour monitors) or in
  2842.             reverse video (monochrome monitors).
  2843.  
  2844. MOUSE%      should be set to TRUE (-1) or FALSE (0) to indicate if a mouse
  2845.             is installed and can be used to respond.    
  2846.  
  2847. Notes:      The user can respond, either by pressing the <Y> or <N> keys
  2848.             or by using <TAB> to highlight the appropriate radio button
  2849.             and then pressing <RETURN>. 
  2850.  
  2851. Mouse support has now been added, enabling the operator to respond by
  2852. clicking the mouse cursor on the appropriate radio button.
  2853.  
  2854.  
  2855. VGADIM
  2856.  
  2857. Allows a program running on a computer fitted with VGA to dim or brighten
  2858. the display intensity.
  2859.  
  2860. DECLARE SUB VGADim (BYVAL Intensity%)
  2861.  
  2862. Intensity% is a number in the range -63 to +63 which sets the brightness
  2863. of the screen relative to the default value (zero).
  2864.  
  2865.  
  2866. VGALOAD
  2867.  
  2868. Loads EGA, VGA and MCGA screens into video memory from disk. This is an
  2869. alternative to the QuickBASIC BLOAD statement which cannot be used with
  2870. the higher-resolution graphics displays provided by SCREEN modes 7 to 13.
  2871.  
  2872. DECLARE SUB VGALoad (File$)
  2873.  
  2874. FILE$ must be a legal DOS filename, including extension, drive letter and
  2875. directory path where appropriate.
  2876.  
  2877. Note:       The screen image must have been previously written to a disk
  2878.             file using the VGASAVE procedure (see below) and should have
  2879.             the same resolution as that provided by the current SCREEN.
  2880.  
  2881.  
  2882. VGAPAN
  2883.  
  2884. Sets the display window co-ordinates for EGA, VGA and MCGA screens.
  2885.  
  2886. This procedure sets the origins of display window within the video display
  2887. buffer used by the EGA, VGA and MCGA adaptors.  Normally this is at the
  2888. top left-hand corner of the graphics image, but by changing co-ordinates
  2889. you can pan the display through video memory, to create some interesting
  2890. animation effects.
  2891.  
  2892. DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  2893.  
  2894. Example program
  2895.  
  2896. ' OUTPAN.BAS - pans the virtual screen window on EGA and VGA
  2897. '              display adaptors.
  2898. '
  2899. '   Author:    Christy Gemmell
  2900. '   For:       Assembly-Language ToolBox for QuickBASIC
  2901. '   Date:      11/12/89
  2902. '
  2903.     DECLARE FUNCTION KeyIn% ()
  2904.     DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  2905.  
  2906.     CONST FALSE = 0, TRUE = NOT FALSE
  2907.  
  2908.     SCREEN 9: LINE (0, 0)-(639, 349), 9, BF
  2909.     VIEW SCREEN (40, 25)-(600, 325), 0, 15
  2910.     CIRCLE (319, 174), 150, 14: PAINT (319, 174), 14, 14
  2911.  
  2912.     X% = 0: Y% = 0
  2913.  
  2914.     DO
  2915.         KeyPress% = KeyIn%: Pan% = TRUE
  2916.         SELECT CASE KeyPress%
  2917.             CASE -75
  2918.                 IF X% > 0 THEN X% = X% - 1
  2919.             CASE -77
  2920.                 IF X% < 79 THEN X% = X% + 1
  2921.             CASE -72
  2922.                 IF Y% > 0 THEN Y% = Y% - 1
  2923.             CASE -80
  2924.                 IF Y% < 22 THEN Y% = Y% + 1
  2925.             CASE ELSE
  2926.                 Pan% = FALSE
  2927.         END SELECT
  2928.         IF Pan% THEN VGAPan X%, Y% * 5
  2929.     LOOP UNTIL KeyPress% = 27
  2930. END
  2931.  
  2932.  
  2933. VGASAVE
  2934.  
  2935. Saves EGA, VGA and MCGA screens from video memory to disk. 
  2936.  
  2937. The normal QuickBASIC BLOAD and BSAVE statements only work properly with
  2938. text and CGA graphics screens. This routine allows you to do the same
  2939. with higher-resolution graphic displays in SCREEN modes 7 to 13.
  2940.  
  2941. DECLARE SUB VGASave (File$)
  2942.  
  2943. FILE$ must be a legal DOS filename, including the extension, drive letter
  2944. and directory path where appropriate.
  2945.  
  2946. A companion procedure, VGALOAD (see above) is provided to allow you to
  2947. retrieve the graphics image from disk, and restore it to the screen.
  2948.  
  2949. Example program
  2950.  
  2951. ' VGAFILE.BAS  saves and loads a high-resolution graphics image
  2952. '
  2953. '   Author:     Christy Gemmell
  2954. '   For:        Assembly-Language ToolBox for QuickBASIC
  2955. '   Date:       11/12/89
  2956. '
  2957. '   Graphics converted from Microsoft Extended Color BASIC
  2958. '
  2959.     DECLARE SUB VGALoad (File$)
  2960.     DECLARE SUB VGASave (File$)
  2961.  
  2962.     ScreenMode% = 12              ' Try other modes as well
  2963.  
  2964.     SELECT CASE ScreenMode%
  2965.         CASE 7, 13
  2966.              xMax% = 319: yMax% = 199
  2967.         CASE 8
  2968.              xMax% = 639: yMax% = 199
  2969.         CASE 9, 10
  2970.              xMax% = 639: yMax% = 349
  2971.         CASE 11, 12
  2972.              xMax% = 639: yMax% = 479
  2973.         CASE ELSE
  2974.     END SELECT
  2975.  
  2976.     SCREEN ScreenMode%: KEY OFF
  2977.     LINE (0, 0)-(xMax%, yMax%), 6, BF
  2978.     VIEW (32, 4)-(xMax% - 32, yMax% - 4), 0, 5
  2979.     WINDOW SCREEN (0, 0)-(255, 191)
  2980.     FOR I% = 1 TO 40
  2981.         READ A%, B%, C%, D%: LINE (A%, B%)-(C%, D%), 1
  2982.     NEXT I%
  2983.     PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
  2984.     PAINT (120, 80), 1, 1: PAINT (192, 88), 14, 1
  2985.     PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
  2986.     PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
  2987.     PAINT (92, 128), 2, 1: PAINT (36, 156), 12, 1
  2988.     PAINT (36, 168), 1, 1: PAINT (84, 178), 14, 1
  2989.     PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
  2990.     VGASave "ESCHER.IMG": SLEEP 1: CLS : SLEEP 3
  2991.     VGALoad "ESCHER.IMG": R$ = INPUT$(1)
  2992. END
  2993.  
  2994. DATA    68,4,200,76,52,12,112,44,128,52,172,76,128,52,68,84,112,44,84,60
  2995. DATA    128,68,99,84,68,36,97,52,128,68,154,84,128,68,128,116,128,52,128
  2996. DATA    68,68,4,52,12,172,76,142,90,142,76,142,108,142,108,200,76,200,76
  2997. DATA    200,92,200,92,68,164,128,116,84,140,52,12,52,154,52,154,68,164
  2998. DATA    68,164,68,100,68,36,68,84,84,45,84,76,84,109,84,140,68,100,97,116
  2999. DATA    84,124,112,108,68,84,128,116,84,76,112,92,112,77,112,108,84,119
  3000. DATA    92,114,142,86,151,82,180,66,186,62,186,62,236,90,236,90,68,184
  3001. DATA    68,184,16,154,16,154,52,133,16,154,16,160,16,160,68,190,68,190
  3002. DATA    68,184,68,190,236,96,236,96,236,90
  3003.  
  3004.  
  3005. VGATEXT
  3006.  
  3007. Writes characters to the screen in EGA and VGA graphics modes.
  3008.  
  3009. DECLARE SUB VgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  3010.                      BYVAL Attr%, BYVAL Scale%)
  3011.  
  3012. This routine provides a convenient way of displaying text in any of the
  3013. EGA and VGA graphics modes (SCREENs 7-12) without having to bother about
  3014. loading external font files. It uses the standard character definition
  3015. tables built into your display adaptor, but allows you to scale them up to
  3016. eight times normal size and to specify any combination of foreground and
  3017. background colours supported by the current video mode.
  3018.  
  3019. XLOC%       The horizontal co-ordinate of the top left hand pixel
  3020.             from which the text will begin
  3021.  
  3022. YLOC%       The vertical co-ordinate of the top left hand pixel
  3023.             from which the text will begin
  3024.  
  3025. TEXT$       The string of text to be displayed (up to 63 characters).
  3026.  
  3027. ATTR%       The colour (or display attribute in monochrome modes) to
  3028.             be given to the text. This is calculated by the formula:
  3029.  
  3030.             Colour% = (Background% * 256) + Foreground%
  3031.  
  3032.             Foreground and Background values are in the ranges used
  3033.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  3034.             actual colours displayed depend upon your current PALETTE
  3035.             settings.
  3036.  
  3037.             Note:   supplying a value of -1 for background prevents
  3038.                     background pixels from being changed at all. This
  3039.                     allows text to be blended more naturally into a
  3040.                     complex graphics display.
  3041.  
  3042. SCALE%      The character size of the text to be displayed. This ranges
  3043.             from 1 to 8, where 1 is standard 80-column text (40-column
  3044.             in SCREEN 7) and 8 multiplies the character size by eight
  3045.             on both the horizontal and vertical axes.
  3046.  
  3047. VGATEXT can handle both byte-aligned and non byte-aligned characters. The
  3048. x, y co-ordinates you supply do not need to correspond to a row, column
  3049. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  3050. ASCII character set is supported, including foreign symbols and
  3051. box-drawing characters.
  3052.  
  3053. Since VGATEXT does not support clipping, to ensure a clean display you
  3054. must ensure that the text to be output fits within the current screen
  3055. boundaries.
  3056.  
  3057. See also CGATEXT for displaying characters in SCREEN 1 and MCGATEXT for
  3058. displaying characters in SCREEN 13.
  3059.  
  3060.  
  3061. WEEKDAY
  3062.  
  3063. This function is used to determine the day of the week for a given date.
  3064. It does this by temporarily resetting the system date to the one supplied,
  3065. reading the day from DOS, and then restoring the old date. The weekday is
  3066. returned as a number between 0 and 6, signifying Sunday through Saturday.
  3067.  
  3068. DECLARE FUNCTION WeekDay% (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  3069.  
  3070.  
  3071. ──────────────────────────────────────────────────────────────────────
  3072.  
  3073. EXTRA ROUTINES FOR QB4
  3074.  
  3075. The following functions and procedures are only included in the version of
  3076. the Toolbox intended for QuickBASIC 4.x and BASIC 6. They are omitted from
  3077. the later version because the Extended QuickBASIC language provided with
  3078. the BASIC 7 Professional Development System includes new statements and
  3079. functions that render them unneccessary. Well they say that imitation IS
  3080. the sincerest form of flattery!
  3081.  
  3082.  
  3083. FINDFIRST
  3084.  
  3085. This routine sets the Disk Transfer Address to point to a local buffer and
  3086. then attempts to find a match for the file specified in WildCard$. If one
  3087. or more matches are found, the filename of the first matching file (minus
  3088. directory path), is stuffed into the second string argument. If no match
  3089. is found, this string is filled with blank spaces.
  3090.  
  3091. DECLARE SUB FindFirst (Attr%, WildCard$, Match$)
  3092.  
  3093. WildCard$ can contain an ambiguous filename, using the wildcard characters
  3094. * and ?, in which case FINDFIRST will only find the first matching file.
  3095. To obtain the names of any subsequent matches, use the FINDNEXT function
  3096. (see below).
  3097.  
  3098. Match$ must be at least twelve characters long to hold the returning
  3099. filename and extension. You do not need to clear the string first as the
  3100. function does that for you, automatically.
  3101.  
  3102. Normally, only visible files with full read\write access are found, but
  3103. you can extend this to search for hidden, read-only or system files as
  3104. well by setting the Attr% parameter to the appropriate attribute value.
  3105.  
  3106.    Attr% = 0   Visible read\write
  3107.            1   Read-only files
  3108.            2   Hidden files
  3109.            4   System files
  3110.  
  3111. Do not use the FILESIZE function while searching for files with FINDFIRST
  3112. and FINDNEXT. Since both routines relocate the DOS Disk Transfer Address
  3113. during operation, this may lead to a conflict which will cause your
  3114. program to lose track of one or more open files. You should, in any case,
  3115. always use the RESETDTA routine to restore the Disk Transfer Address after
  3116. FINDFIRST/FINDNEXT is completed.
  3117.  
  3118. The DIR$ function which Microsoft have added to Extended QuickBASIC (QBX)
  3119. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3120. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3121.  
  3122.  
  3123. FINDNEXT
  3124.  
  3125. Finds successive matches of an ambiguous filename after a previously
  3126. successful call to FINDFIRST (see above). You can call it repeatedly
  3127. until a blank string is returned in Match$, in which case there are
  3128. no more files to be found.
  3129.  
  3130. DECLARE SUB FindNext (Match$)
  3131.  
  3132. Match$ must be at least twelve characters long to hold the returning
  3133. filename and extension. It does not have to be cleared first, since the
  3134. routine does this for you, automatically.
  3135.  
  3136. Do not make use the FILESIZE function while searching for files with
  3137. FINDFIRST and FINDNEXT. Since both routines relocate the DOS Disk Transfer
  3138. Address during operation, this may lead to a conflict which will cause
  3139. your program to lose track of one or more open files. You should, in any
  3140. case, always use the RESETDTA routine to restore the Disk Transfer Address
  3141. after FINDFIRST/FINDNEXT is completed.
  3142.  
  3143. The DIR$ function which Microsoft have added to Extended QuickBASIC (QBX)
  3144. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3145. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3146.  
  3147.  
  3148. GETDIR
  3149.  
  3150. This procedure writes the pathname of the currently logged directory into
  3151. the string supplied by the caller. The user can specify what drive to
  3152. return the directory for, or default to the current drive.
  3153.  
  3154. DECLARE SUB GetDir (Drive%, Path$)
  3155.  
  3156. This routine expects two arguments to be passed to it. The first is an
  3157. integer which specifies the drive to look at :
  3158.  
  3159. 0 = default drive, 1 = drive A:, 2 = drive B:, etc.
  3160.  
  3161. the second argument is a string which will hold the path of the directory
  3162. returned by DOS. The string must be at least 64 bytes long to hold the
  3163. information. If it were not, the function might overwrite other variables
  3164. in the program data space, with unpredictable results. The returned path-
  3165. name does not include the drive identifier or a leading '\' and is
  3166. terminated by a null (0) byte. if the current directory is the root
  3167. directory, therefore, the first byte of the string will be an ASCII zero,
  3168. not a null string.
  3169.  
  3170. The CURDIR$ function which Microsoft have added to Extended QuickBASIC
  3171. (QBX) allows you to obtain the current directory path and drive, making
  3172. GETDIR redundant. It is, therefore, omitted from the BASIC 7 version of
  3173. the Assembly Language Toolbox.
  3174.  
  3175.  
  3176. GETDRIVE
  3177.  
  3178. This function returns the number of the currently-logged drive.
  3179.  
  3180. No calling parameters are required.
  3181.  
  3182. DECLARE FUNCTION GetDrive% ()
  3183.  
  3184. Values returned are in the series 0 = A:, 1 = B:, 2 = C:, etc.
  3185.  
  3186. The CURDIR$ function which Microsoft have added to Extended QuickBASIC
  3187. (QBX) allows you to obtain the current directory path and drive, making
  3188. GETDRIVE redundant. It is, therefore, omitted from the BASIC 7 version of
  3189. the Assembly Language Toolbox.
  3190.  
  3191.  
  3192. RESETDTA
  3193.  
  3194. This procedure must always be called by your program after the FINDFIRST
  3195. and FINDNEXT functions have been used. It restores the Disk Transfer
  3196. Address to its default value originally set by QuickBASIC.
  3197.  
  3198. No calling parameters are required.
  3199.  
  3200. DECLARE SUB ReSetDTA ()
  3201.  
  3202.  
  3203. SETDRIVE
  3204.  
  3205. This function changes the currently-logged drive to the one specified by
  3206. the calling program (0 = A:, 1 = B:, etc.).
  3207.  
  3208. DECLARE SUB SetDrive (Drive%)
  3209.  
  3210. Since BASIC 7 has now introduced the CHDRIVE statement which performs the
  3211. same task, SETDRIVE is only supported in the version of the Toolbox
  3212. supplied to QuickBASIC 4 users.
  3213.  
  3214.  
  3215. ──────────────────────────────────────────────────────────────────────
  3216.  
  3217. ASSEMBLY-LANGUAGE TOOLBOX INTERNAL FUNCTIONS
  3218.  
  3219. The following functions and procedures are used internally by Toolbox
  3220. routines. Assembly-Language programmers may also call them when adding
  3221. routines of their own, provided the appropriate object modules are linked
  3222. to their program at runtime.
  3223.  
  3224.  
  3225. FLAGS
  3226.  
  3227. Sets or gets the current status of individual flags in the Intra-
  3228. Application Communications area (IAC), a 16-byte block of RAM reserved, by
  3229. DOS, for signalling between applications programs.
  3230.  
  3231. Three parameters must be passed on the stack, they are:
  3232.  
  3233.         1)  Switch%     0 = get flag,   1 = set flag
  3234.         2)  Flag%       the offset into the IAC flag table (0 to 15)
  3235.         3)  Setting%    the value to be set into the specified byte
  3236.                         of the flag table (if Switch% = 1).
  3237.  
  3238. This example code fragment sets letter 'A' (ASCII 65) into flag 8 (byte 9)
  3239. of the IAC area.
  3240.  
  3241.             .model  medium              ; Required for QuickBASIC
  3242.  
  3243.             extrn   Flags: far          ; Public name of called routine
  3244.  
  3245.             .code                       ; Define code segment
  3246.  
  3247.             mov     ax,1                ; Set a flag byte
  3248.             push    ax                  ; Pass it on the stack
  3249.             mov     ax,8                ; Flag number 8
  3250.             push    ax                  ; Pass it on the stack
  3251.             mov     ax,'A'              ; Value to set
  3252.             push    ax                  ; Pass it on the stack
  3253.             call    Flags               ; Call the function
  3254.  
  3255. You must still push three parameters onto the stack even if you are only
  3256. reading a flag setting. In this case the third argument will be ignored.
  3257.  
  3258. The setting of the specified IAC flag is returned in the lower byte of the
  3259. AX register (AL). All other registers are preserved.
  3260.  
  3261.  
  3262. GETVERSION
  3263.  
  3264. This function checks the version of DOS under which the host computer is
  3265. currently running.
  3266.  
  3267.             extrn   GetVersion: far
  3268.  
  3269. The following register values may be returned:
  3270.  
  3271.     AL      = Major Version       (MS-DOS 3.2 = 3, etc.)
  3272.     AH      = Minor Version       (MS-DOS 3.2 = 20, etc.) 
  3273.                             
  3274. GETVERSION can be called directly from QuickBASIC, in which case only the
  3275. Major and Minor version numbers returned in AX are available.
  3276.  
  3277. Note:   This function returns the correct version number even under
  3278.         DOS 5.x with SETVER configured to return a different number.
  3279.  
  3280.  
  3281. HIDECURSOR
  3282.  
  3283. Makes the cursor invisible. No parameters are required or returned.
  3284.  
  3285.             extrn   HideCursor: far
  3286.  
  3287. This method ORs the byte value of the cursor start line with 32 (20 Hex)
  3288. which, on all standard video adaptors, turns off the cursor while
  3289. preserving its display characteristics. You can use the SHOWCURSOR
  3290. routine (see below) to restore the cursor to its previous state.
  3291.  
  3292. Note:       HIDECURSOR can be called directly from QuickBASIC but, since
  3293.             the LOCATE statement provides an alternative means of turning
  3294.             off the cursor, it is not necessary.
  3295.  
  3296.  
  3297. SCREENADDRESS
  3298.  
  3299. Calculate screen address from a pair of row/column co-ordinates.
  3300.  
  3301.             extrn   ScreenAddress: far
  3302.  
  3303. Given the row/column column co-ordinate of a character on the screen, this
  3304. function returns the segment:offset address of that character in video
  3305. memory. The address is correctly adjusted to the start of the the
  3306. currently active display page, but no check is made to ensure that the
  3307. co-ordinates supplied are within the actual screen bounds.
  3308.  
  3309. Input:      AL      = Row co-ordinate of character (0 = row 1).
  3310.             AH      = Column co-ordinate of character (0 = column 1).
  3311.  
  3312. Output:     ES:DI==>  Address in video display buffer of the
  3313.                       character cell specified.
  3314.             DX      = CRT status register port address.
  3315.  
  3316. It is assumed that a previous call has been made to the VIDEOTYPE function
  3317. (see below), to determine the screen width, the port address of the CRT
  3318. status register and the correct video display segment. 
  3319.  
  3320.  
  3321. SCREENCOPY
  3322.  
  3323. Copy a character and attribute from the video display to a buffer at the
  3324. address specified.
  3325.  
  3326.             extrn   ScreenCopy: far
  3327.  
  3328. If the 'snow prevention' flag is set, this routine waits until the
  3329. beginning of the next CRT horizontal retrace period before reading data
  3330. from the display. This is necessary only on machines fitted with a Colour
  3331. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  3332. data is copied from the screen while the video buffer is being refreshed.
  3333.  
  3334. Input:      DS:SI==>    Address of the screen location from which
  3335.                         the data is to be copied. 
  3336.             ES:DI==>    Address of the buffer into which the data
  3337.                         is to be copied.
  3338.             DX =        Port address of CRT status register.
  3339.  
  3340. Output:     SI and DI   Updated to point to next buffer locations.
  3341.             AX          destroyed.
  3342.  
  3343. It is assumed that a previous call has been made to the VIDEOTYPE function
  3344. (see below), to determine the screen width, the port address of the CRT
  3345. status register and the correct video display segment. VIDEOTYPE also sets
  3346. an internal 'snow-prevention' flag if the host machine has a CGA display
  3347. adaptor installed. This activates a routine which synchronises direct
  3348. video reads and writes to the CRT vertical retrace period, preventing
  3349. interference on the display.
  3350.  
  3351.  
  3352. SCREENREAD
  3353.  
  3354. Read a character and attribute from the display.
  3355.  
  3356.             extrn   ScreenRead: far
  3357.  
  3358. This procedure is similar to SCREENCOPY (see above), except that the word
  3359. is simply loaded into AX instead of being copied into a buffer.
  3360.  
  3361. Input:      DS:SI==>    address, in the video display buffer, from
  3362.                         where the data is to be read
  3363.             DX =        port address of the CRT status register.
  3364.  
  3365. Output:     AL =        character at the specified address
  3366.             AH =        display attribute given to character
  3367.             DI          updated to point to the next word address
  3368.  
  3369. It is assumed that a previous call has been made to the VIDEOTYPE function
  3370. (see below), to determine the screen width, the port address of the CRT
  3371. status register and the correct video display segment. VIDEOTYPE also sets
  3372. an internal 'snow-prevention' flag if the host machine has a CGA display
  3373. adaptor installed. This activates a routine which synchronises direct
  3374. video reads and writes to the CRT vertical retrace period, preventing
  3375. interference on the display.
  3376.  
  3377.  
  3378. SCREENWRITE
  3379.  
  3380. Output a character and attribute to the video display.
  3381.  
  3382.             extrn   ScreenWrite: far
  3383.  
  3384. If the 'snow prevention' flag is set, this routine waits until the
  3385. beginning of the next CRT horizontal retrace period before writing data to
  3386. the display. This is necessary only on machines fitted with a Colour
  3387. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  3388. data is written to the screen while the video buffer is being refreshed.
  3389.  
  3390. Input:      ES:DI==>    Address in the video display buffer where
  3391.                         the data is to be written. 
  3392.             DX =        Port address of CRT status register.
  3393.             AL =        Character to output.
  3394.             AH =        Display attribute to set
  3395.  
  3396. Output:     DI          Updated to point to next output address.
  3397.  
  3398. It is assumed that a previous call has been made to the VIDEOTYPE function
  3399. (see below), to determine the screen width, the port address of the CRT
  3400. status register and the correct video display segment. VIDEOTYPE also sets
  3401. an internal 'snow-prevention' flag if the host machine has a CGA display
  3402. adaptor installed. This activates a routine which synchronises direct
  3403. video reads and writes to the CRT vertical retrace period, preventing
  3404. interference on the display.
  3405.  
  3406.  
  3407. SHOWCURSOR
  3408.  
  3409. Makes the cursor visible. No parameters are required or returned.
  3410.  
  3411.             extrn   ShowCursor: far
  3412.  
  3413. This method ANDs the byte value of the cursor start line with 31 (1F Hex)
  3414. which, restores the cursor after being made invisible by the HIDECURSOR
  3415. routine (see above).
  3416.  
  3417. Note:       SHOWCURSOR can be called directly from QuickBASIC but, since
  3418.             the LOCATE statement provides an alternative means of turning
  3419.             the cursor on and off, it is not needed in high-level code.
  3420.  
  3421.  
  3422. VIDEO
  3423.  
  3424. Video equipment check. This function returns information about the active
  3425. display adaptor installed in the host system.
  3426.  
  3427.             extrn   Video: far
  3428.  
  3429. No input parameters are required, on return AX should be examined for the
  3430. following values:
  3431.     
  3432.         AL = type of video adaptor installed
  3433.  
  3434.              1 = MDA   - Monochrome Display Adaptor
  3435.              2 = CGA   - Colour Graphics Adaptor
  3436.              3 = HGC   - Hercules Graphics Card
  3437.              4 = HGC+  - Hercules Graphics Card Plus
  3438.              5 = HIC   - Hercules InColour Card
  3439.              6 = EGA   - Extended Graphics Adaptor
  3440.              7 = PGA   - Professional Graphics Adaptor (IBM PS/2)
  3441.              8 = VGA   - Video Graphics Array
  3442.              9 = MCGA  - MultiColour Graphics Adaptor  (IBM PS/2)
  3443.  
  3444.         AH  (bits 0-6) = size of display memory in 16K blocks
  3445.                          (0 = <16K, 1 = 16K, 2 = 32K, etc.)
  3446.             (bit 7)    = type of display monitor in use
  3447.                          (0 = colour, 1 = monochrome) 
  3448.  
  3449.  
  3450. VIDEOTYPE
  3451.  
  3452. Collects information about the current video display and sets various
  3453. internal flags.
  3454.  
  3455.             extrn   VideoType: far
  3456.  
  3457. The correct video display segment and CRT status port addresses are
  3458. determined for the current system and, if necessary, the internal 'snow'
  3459. prevention flag is set.
  3460.  
  3461. Input:      nothing
  3462.  
  3463. Output:     AL =    Current display mode
  3464.             AH =    Screen width in columns
  3465.             BL =    Screen height in rows
  3466.             BH =    Active display page
  3467.  
  3468. You should make a preliminary call to this function before using any of
  3469. the other internal routines which directly access video memory.
  3470.  
  3471.  
  3472. WRITEBYTE
  3473.  
  3474. Output a byte of data to video memory.
  3475.  
  3476.             extrn   WriteByte: far
  3477.  
  3478. This procedure is similar to ScreenWrite, above, except that only a single
  3479. byte is written. It is used by the BackFill routine to reset the display
  3480. attribute of a character, without changing the character itself.
  3481.  
  3482. Input:      ES:DI==>    address, in the video display buffer, where
  3483.                         the byte is to be written.
  3484.             DX =        port address of the CRT status register.
  3485.             AL =        the byte value to be written.
  3486.  
  3487. Output:     DI          updated to point to the next byte address
  3488.  
  3489. It is assumed that a previous call has been made to the VIDEOTYPE function
  3490. (see above) to determine the screen width, the port address of the CRT
  3491. status register and the correct video display segment. VIDEOTYPE also sets
  3492. an internal 'snow-prevention' flag if the host machine has a CGA display
  3493. adaptor installed. This activates a routine which synchronises direct
  3494. video reads and writes to the CRT vertical retrace period, preventing
  3495. interference on the display.
  3496.  
  3497.  
  3498. ─────────────────────────────────────────────────────────────────────────
  3499.